I am creating a Gridview and binding it to a collection on the selectedindexchange event of a dropdown.
<asp:GridView ID="grv" runat="server" AutoGenerateColumns = "false" DataKeyNames = "DRID" OnRowDataBound="grv_RowDataBound"
OnRowEditing = "grv_RowEditing" OnRowCancelingEdit = "grv_RowCancelingEdit" OnRowUpdating = "grv_RowUpdating"
OnRowDeleting = "grv_RowDeleting" EnableViewState="false" OnRowUpdated = "grv_RowUpdated">
I have templatecolumns and commandfield inside this gridview.
With a click of a button outside gridview I am adding a new row and adding it to my collection and gridvew.
Now, when i am trying to edit the rows , OnRowUpdating is not getting fired. Previously, I had viewstate on but it was throwing me error :
Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back
The row_updating event was also getting fired with this setting (EnableViewstate = true). How can I make my dynamic row work with the updation.
Appreciate your responses!!!!