I have a gridview inside update panel and a button on whose click gridview is binded.
<asp:UpdatePanel runat="server" ID="upPanelPrjSumm" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="gvProjectionSummary" runat="server"
AutoGenerateColumns="true" AllowPaging="true" PageSize="18"
OnPageIndexChanging="gvProjectionSummary_PageIndexChanging"
OnRowDataBound="gvProjectionSummary_RowDataBound" PagerSettings-
Mode="Numeric" >
</asp:GridView>
<asp:Button runat="server" ID="btnChange" OnClick="btnChange_Click"
Text="Change" />
</ContentTemplate>
<Triggers>
</Triggers>
</asp:UpdatePanel>
When I click on Change button , gridview is rebinded but page index number is reset to 1 irrespective of on which page I was when button was clicked.
1 2 3 4
How to maintain page number while using this Update panel control.
You can put the page number in ViewState and update it just before you rebind it. just before rebinding the GridView assign the page number from the ViewState
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With