Hi @Simon ,
Thanks for reaching out.
When you click the Edit button in a GridView, the page performs a full postback. That means it will go through the normal page lifecycle again - Page_Init, then Page_Load, then the GridView’s Edit event, and finally Page_PreRender.
So it’s completely normal that Page_Init and Page_Load run first.
Now, if your Edit action doesn’t seem to work, a possible reason is that the GridView is being rebound on every Page_Load. When you rebind the GridView without checking IsPostBack, it resets the control state, which cancels the edit mode before it can render.
Make sure your data binding is wrapped like this:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGrid();
}
}
And your Edit handler should look something like:
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
BindGrid();
}
Please treat the code above as a reference example, you’ll need to adjust the method names, control IDs, and binding logic to match your actual project structure.
Hope this helps! If my answer was helpful - kindly follow the instructions here so others with the same problem can benefit as well.