zoukankan      html  css  js  c++  java
  • repeater 嵌套

    代码
     Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load
            
    Dim dt As DataTable = New DataTable
            
    Dim sqlCom As SQLCommon = New SQLCommon
            dt 
    = sqlCom.ExecuteQuery("SELECT * FROM tblProductCategory")
            
    Me.rptCategory.DataSource = dt
            
    Me.rptCategory.DataBind()

        
    End Sub

        
    Protected Sub rptCategory_ItemDataBound(ByVal sender As ObjectByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptCategory.ItemDataBound
            
    Dim sqlCom As SQLCommon = New SQLCommon
            
    Dim dt As DataTable = New DataTable

            
    If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
                
    Dim rep As System.Web.UI.WebControls.Repeater = e.Item.FindControl("rptSubCategory")
                
    Dim rowv As DataRowView = CType(e.Item.DataItem, DataRowView)
                
    Dim strKey As String = CType(rowv("productCategoryName"), String)
                dt 
    = sqlCom.ExecuteQuery("SELECT * FROM tblProductSubCategory WHERE productCategoryName='" & strKey & "'")
                rep.DataSource 
    = dt
                rep.DataBind()



            
    End If
        
    End Sub
    代码
     <form id="form1" runat="server">
            
    <asp:Repeater ID="rptCategory" runat="server">
                
    <ItemTemplate>
                    
    <%#Eval("productCategoryName")%>   <br />
                    
    <asp:Repeater ID="rptSubCategory" runat ="server" >
                    
    <ItemTemplate >
                    
    <div style ="color :Red;"><%#Eval("productSubCategoryName")%> </div>
                    
    </ItemTemplate>
                    
    </asp:Repeater>                           
                
    </ItemTemplate>
            
    </asp:Repeater>
        
    </form>
  • 相关阅读:
    Encrypted Handshake Message
    RSAParameters Struct
    What if JWT is stolen?
    What's the difference between JWTs and Bearer Token?
    RSA Algorithm Example
    第18届Jolt大奖结果公布
    Ruby on rails开发从头来(windows)(三十六) 调试技巧
    Ruby on rails开发从头来(四十二) ActiveRecord基础(主键和ID)
    YouTube开放基础技术架构 让用户建自家YouTube
    Ruby on rails开发从头来(四十) ActiveRecord基础(Boolean属性)
  • 原文地址:https://www.cnblogs.com/services/p/1703374.html
Copyright © 2011-2022 走看看