<asp:Repeater ID="rpt1" runat="server" onitemdatabound="rpt1_ItemDataBound">
      
           <ItemTemplate>
           <asp:Label ID="lblzyc" runat="server" Text='<%#Eval("id") %>' Visible="false"></asp:Label>
           <h1 onClick="javascript:ShowMenu(this,'NO0')"><%#Eval("name") %></h1>
             <span ) %></a></li> 
        
      
                                                    </ItemTemplate>
                                               
                                              </asp:Repeater>
                                             </ul>
                                     
                                 </ItemTemplate>
                          
                        </asp:Repeater>
                     </span>
           </ItemTemplate>
        
        
       
        </asp:Repeater>

 protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataBind();
        }
    }
    private void DataBind()
    {
        string sql = "select * from tclass where rootid=0";
        DataTable dt = lisichuang.myDataAdapter(sql);
        rpt1.DataSource = dt;
        rpt1.DataBind();
    }
    protected void rpt1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            Repeater dataList = (Repeater)e.Item.FindControl("rpt2");
            Label lbl = (Label)e.Item.FindControl("lblzyc");

            int mainID = Convert.ToInt32(lbl.Text);
            //this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + mainID.ToString() + "!')</script>");
            if (mainID > 0)
            {
                //string sql = "select * from  article";
                string sql = "select  * from tclass where root);

            int mainID = Convert.ToInt32(lbl.Text);
            //this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + mainID.ToString() + "!')</script>");
            if (mainID > 0)
            {
                //string sql = "select * from  article";
                string sql = "select  * from tclass where root;
                DataTable dt = lisichuang.myDataAdapter(sql);
                dataList.DataSource = dt;
                dataList.DataBind();
            }
        }
    }

相关文章:

  • 2022-12-23
  • 2021-09-18
  • 2022-02-24
  • 2021-06-07
  • 2021-06-11
  • 2021-09-17
猜你喜欢
  • 2022-12-23
  • 2021-05-14
  • 2021-11-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案