本文介绍了在ASp.net中进行GridView编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我现在有一个带有ISEnabled列的网格视图,我想编辑特定的行,并在其中可以使用Dropdown编辑ISEnabled.
我在下拉菜单中有一个编辑项目.
Hello,
i have a grid view with a coloumn ISEnabled now i want to edit a particular row and where i can edit the ISEnabled using Drop down .
I have a drop down in edit item temple .
can any one suggested with with this.
推荐答案
protected void gvCheck_RowEditing(object sender, GridViewEditEventArgs e)
{
gvCheck.EditIndex = e.NewEditIndex;
gvCheck.DataSource = ViewState["YourViewstateName OR Session"] as DataTable;//For binding your grid.
gvCheck.DataBind();
DropDownList ddlTest = (DropDownList)gvCheck.Rows[e.NewEditIndex].FindControl("ddlTest");
ddlTest.DataSource = ViewState["YourViewstateName OR Session"] as DataTable;// For binding your dropdown
ddlTest.DataTextField = "Name";
ddlTest.DataValueField = "Name";
ddlTest.DataBind();
ddlTest.Items.Insert(0, new ListItem("Select", "0"));
}
这篇关于在ASp.net中进行GridView编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!