<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();
}
}
}