How to generate unordered list dynamically in asp.net?

前端 未结 2 549
孤独总比滥情好
孤独总比滥情好 2021-01-02 08:21

I want to generate a unordered list which contains tag for showing images in my database, I take a look at bulleted list, but it is not working with image. How can i dynami

2条回答
  •  一个人的身影
    2021-01-02 08:43

    For what you are trying to achieve, it would be best and easiest just to use a control.

    There is a good tutorial here on how to use it, and pretty much similar to what you are doing http://weblogs.asp.net/scottgu/archive/2007/08/10/the-asp-listview-control-part-1-building-a-product-listing-page-with-clean-css-ui.aspx

    It would basically involve you creating a control like;

    
        
            
  • <%#Eval("UserName")%>
  • Nothing here.

    Then binding your data to it.

    this.ListView1.DataSource = YourDataSource;
    this.ListView1.DataBind();
    

提交回复
热议问题