Place the logic to bind the gridview inside IsPostback check in page_load like
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostback)
{
GridView gv = new GridView();
gv.ID = pId.ToString();
gv.AutoGenerateEditButton = true;
gv.DataKeyNames = ids;
gv.RowEditing += gv_RowEditing;
gv.RowUpdating += gv_RowUpdating;
bindGv(pId, gv);
}
}
Hope, it helps :)