如何动态添加编辑,更新按钮到Gridview? [英] How Do I Add Add Edit,Update Buttons To A Gridview Dynamically ?
本文介绍了如何动态添加编辑,更新按钮到Gridview?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经动态创建了一个gridview。我希望在后面的代码中添加用于编辑,更新和删除的按钮但是找不到解决方案。
解决方案
您可以在网格中使用网格默认的添加/编辑/删除列,并根据需要隐藏和显示。
-Maheswaran.S
查看此链接。
http://forums.asp.net/t/1581090.aspx?Dynamic+GridView+Delete+Button [ ^ ]
我使用了autoGenerateEditButton函数gridview。
受保护 < span class =code-keyword> void Page_Load( object sender,EventArgs e)
{
v iewgrid.AutoGenerateEditButton = true ;
viewgrid.RowEditing + = new GridViewEditEventHandler(viewTable_RowEditing);
}
void viewTable_RowEditing( object sender,GridViewEditEventArgs e)
{
viewTable.EditIndex = e.NewEditIndex;
filldata();
}
I have created a gridview dynamically.i want to add buttons for edit ,update and delete in the code behind.i searched but couldn't find a solution.
解决方案
You can have the Grid default Add / Edit / Delete column in the grid and hide and show based on your need.
-Maheswaran.S
Check this link .
http://forums.asp.net/t/1581090.aspx?Dynamic+GridView+Delete+Button[^]
I used the autoGenerateEditButton function of gridview.
protected void Page_Load(object sender, EventArgs e) { viewgrid.AutoGenerateEditButton = true; viewgrid.RowEditing += new GridViewEditEventHandler(viewTable_RowEditing); } void viewTable_RowEditing(object sender, GridViewEditEventArgs e) { viewTable.EditIndex = e.NewEditIndex; filldata(); }
这篇关于如何动态添加编辑,更新按钮到Gridview?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文