在datagrid中动态添加imagebutton [英] adding imagebutton in datagrid dynamically
本文介绍了在datagrid中动态添加imagebutton的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在动态创建数据网格.
如何在该数据网格中添加imagebutton?
预先谢谢您,
jhyn
Hello everyone,
Im creating datagrid dynamically.
How can i add imagebutton in that datagrid?
Thank you in advance,
jhyn
推荐答案
...
GridView gView = new GridView();
gView.RowDataBound += new GridViewRowEventHandler(gView_RowDataBound);
}
void gView_RowDataBound(object sender, GridViewRowEventArgs e)
{
ImageButton imgButton = new ImageButton();
imgButton.ImageUrl = "~/Image.png";
imgButton.Click += new ImageClickEventHandler(imgButton_Click);
e.Row.Cells[0].Controls.Add(imgButton);
}
void imgButton_Click(object sender, ImageClickEventArgs e)
{
throw new NotImplementedException();
}
如果有帮助,请 投票 和 接受答案 .
Please vote and Accept Answer if it Helped.
这篇关于在datagrid中动态添加imagebutton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文