Gridview Control Coding
I am using Gridview control in Asp.Net.I have inserted data in one page and in another I am using Gridview control. In that I can Select,Delete Gridview. But I can't Update data.Can anyone help me?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Pradeep ShetRank #595 · 4K reputationPosted Jul 8, 2014, 10:43 PM EDT
You can do 1 thing in simple way,
1)In case of Update click in a gridview, first of all set the CommandArgument property of button with the primarykeyId
Like,
2) OnRowCommand event of grid, check for the CommandName="UpdateMyData"
if(e.CommandName == "UpdateMyData")
{
string id = e.CommandArgument.toString();
Response.Redirect("InsertPage.aspx?id=" + id);
}
3)In InsertPage.aspx, on page_load event check for querystring value and load the data
if(Request.QueryString["id"] != null)
{
LoadData();
string mode= "update";
}
I hope this will help you to solve your problem. If you think it as helpful please mark it Like.