将imagebutton的事件处理程序作为字符串传递给asp.net中的用户控件
我正在制作一个显示imagebuttons的用户控件。我正在从xml文件中获取id、imageURL和ImageOnClick事件处理程序名称。但不接受事件处理程序名称。 我在.ascx.cs中的代码是:将imagebutton的事件处理程序作为字符串传递给asp.net中的用户控件,asp.net,user-controls,event-handling,imagebutton,Asp.net,User Controls,Event Handling,Imagebutton,我正在制作一个显示imagebuttons的用户控件。我正在从xml文件中获取id、imageURL和ImageOnClick事件处理程序名称。但不接受事件处理程序名称。 我在.ascx.cs中的代码是: var imageDetails = from image in imageDetailsXML.Descendants("image") select new {
var imageDetails = from image in imageDetailsXML.Descendants("image")
select new
{
imgID = image.Element("imgID").Value,
imgUrl = image.Element("imgUrl").Value,
imgClickHandler = image.Element("imgClickHandler").Value
};
foreach (var imageBtn in imageDetails)
{
ImageButton imgBtn = new ImageButton();
imgBtn.ID = imageBtn.imgID.ToString();
imgBtn.ImageUrl = imageBtn.imgUrl.ToString();
imgBtn.Height = height;
imgBtn.Width = width;
imgBtn.Visible = false;
imgBtn.Click += new ImageClickEventHandler(imageBtn.imgClickHandler);
Panel1.Controls.Add(imgBtn);
}
imgClickHandler在.aspx.cs页面中实现。如何将用户控件内图像按钮的图像单击事件绑定到.aspx.cs页面中的处理程序?
我转到以下链接:,但无法理解解决方案。请帮忙