Edit the GridView example, complete with the following code.
Copy Code code as follows:
protected void Gridview1_rowediting (object sender, GridViewEditEventArgs e)
{
Gridview1.editindex = E.neweditindex;
Binggrid ();
}
protected void Gridview1_rowcancelingedit (object sender, Gridviewcancelediteventargs e)
{
Gridview1.editindex =-1;
Binggrid ();
}
protected void Gridview1_rowupdating (object sender, Gridviewupdateeventargs e)
{
Try
{
GridViewRow row = Gridview1.rows[e.rowindex];
String txb_forumname = ((TextBox) row. FindControl ("Txb_forumname")). Text.trim (). ToString ();
int txb_rootforumid = Convert.ToInt16 ((TextBox) row. FindControl ("Txb_rootforumid")). Text.trim ());
int txb_isdisplay = Convert.ToInt16 ((TextBox) row. FindControl ("Txb_isdisplay")). Text.trim ());
String txb_master = ((TextBox) row. FindControl ("Txb_master")). Text.tostring ();
int txb_islock = Convert.ToInt16 ((TextBox) row. FindControl ("Txb_islock")). Text.trim ());
int lb_forumid=convert.toint16 ((Label) row. FindControl ("Label6")). Text);
Forumbll.forum_update_name (Txb_forumname, Txb_isdisplay, Txb_rootforumid, Txb_master, TXB_ISLOCK, LB_FORUMID);
}
catch (Exception ex)
{
Response.Write (ex);
}
Gridview1.editindex =-1;
Binggrid ();
}
GridView Direct Edit, delete classic example download