动态触发多个LinkButton中的事件
代码1.private void Panel_Load(object sender, System.EventArgs e)
{
BLL.Rukuieml bieml=new XLZXWeb.BLL.Rukuieml();
ArrayList listieml=bieml.SelectRukuieml(rukuid);
foreach(model.Rukuieml ieml in listieml)
{
LinkButton boxid=new LinkButton();
boxid.ID=ieml.Getboxid;
boxid.Text=ieml.Getboxid;
if(!IsPostBack)
{
xh1.Value=ieml.Getboxid;
Imel.Value=ieml.Getieml.Replace(";","");
}
Panel.Controls.Add(boxid);
Session["boxid"]=boxid.Text.Trim();
boxid.Click+=new EventHandler(boxid_Click);//
}
}
事件:
private void boxid_Click(object sender, EventArgs e)
{
string boxtext=Session["boxid"].ToString();
BLL.Rukuieml bieml=new XLZXWeb.BLL.Rukuieml();
ArrayList listieml=bieml.SelectRukuieml_xh(boxtext);
foreach(model.Rukuieml ieml in listieml)
{
xh1.Value=ieml.Getboxid;
Imel.Value=ieml.Getieml.Replace(";","");
}
}
请那位高手帮帮忙