【发布时间】:2011-10-24 11:49:14
【问题描述】:
我的项目有问题。我正在动态创建链接按钮以显示项目。当我单击一个项目时,它正在触发,我可以动态显示错误的链接按钮。现在当我点击一个错误时,我也想动态显示描述,但是这个点击事件没有触发,我无法修复它..这是我的代码。
private void LoadXmlBugs(XDocument xDocument)
{
//Load all bugs
IEnumerable<Bugs> data = from query in xDocument.Descendants("bugs")
where (((string)query.Element("bug_status") == "NEW") ||
((string)query.Element("bug_status") == "REOPENED") ||
((string)query.Element("bug_status") == "New"))
select new Bugs
{
Bug_Id = (string)query.Element("bug_id"),
Short_Desc = (string)query.Element("short_desc"),
Bug_Status = (string)query.Element("bug_status"),
Priority = (string)query.Element("priority"),
Creation_Ts = (string)query.Element("creation_ts"),
};
Bugs = new List<Bugs>(data);
string statut = Request.QueryString.Get("bug_status");
foreach (Bugs b in Bugs)
{
System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image();
img.ImageUrl = ("~/Img/FolderIco.png");
PanelAllBugs.Controls.Add(img);
LinkButton lkButtonBugs = new LinkButton();
lkButtonBugs.Click += new EventHandler(lkButtonBugs_Click);
lkButtonBugs.ID = b.Bug_Id;
lkButtonBugs.Tag = b.Short_Desc;
lkButtonBugs.Text = b.Bug_Status + " " + b.Short_Desc + " " + "<br>";
lkButtonBugs.Attributes.Add("runat", "server");
PanelAllBugs.Controls.Add(lkButtonBugs);
}
}
void lkButtonBugs_Click(object sender, EventArgs e)
{
bugId = ((sender as LinkButton).ID);
LoadTheDescriptionForABug(bugId, ((sender as LinkButton).ID));
LoadBugsComments();
LoadBugsAttachments();
}
有人可以帮我吗?
非常感谢。
【问题讨论】:
标签: asp.net webforms linkbutton