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>
  • 相关阅读:
    java连接各种数据库
    java遗传算法
    java中‘==’和’equal‘的区别
    java.net.BindException: Address already in use: JVM_Bind错误,端口设置问题
    Flink学习笔记6 Flink原理-Task(任务)、Operator Chain(算子链)和Slot(资源)
    Flink学习笔记5 Flink原理-资源
    Flink学习笔记4 Flink原理-基础架构
    Flink学习笔记2 CentOS7.5搭建Flink1.6.1分布式集群
    Flink学习笔记1 Flink入门简介
    Dubbo学习笔记12:使用Dubbo中需要注意的一些事情
  • 原文地址:https://www.cnblogs.com/services/p/1703374.html
Copyright © 2011-2022 走看看