Gridview custom paging inside wizard control not working correctly in asp.net

I have a page where guests can be selected.

This page contains the update panel, the update panel has a wizard control, and the wizard has a gridview (panel β†’ update panel β†’ master control β†’ gridview)

Now paging does not work very well, I searched the Internet for answers, but I did not find the right answer. I use custom paging.

When I want to change pagenumber (to the second or last page), it works fine. But when I want to select a row or go to another page, gridview does not work correctly. When I select a line on the second or last page (another page does not work), the selected guest (element) is always one of the first pages. When I want to go to another page (from the second or last page), it does not work and remains on the selected page.

Is there any way to solve this problem?

piece of code:

               <asp:Panel ID="PnlRe" Style="display: none; ... >
    <asp:UpdatePanel ID="UpdtPnlDetail" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
        ...
        <asp:Wizard ID="wzd" runat="server" ... >
            ...
            <asp:WizardStep ID="WizardStep3" runat="server" Title="Naam">
                        ...
                           <asp:Gridview ID="Gridview1" runat="server" AutoGenerateColumns="False"
                               DataKeyNames="GastID,Versie" DataSourceID="odsGasten" EmptyDataText="...."
                               OnRowCommand="Gridview1_RowCommand" OnPageIndexChanging="Gridview1_PageIndexChanging"
                               OnPageSizeChanging="Gridview1_PageSizeChanging" OnSearching="Gridview1_Searching"
                               OnSorting="Gridview1_Sorting" OnRowDataBound="Gridview1_RowDataBound"
                               CausesValidation="False" meta:resourcekey="..." PagerType="Custom"
                               ShowFilter="True" ShowInsertRecord="True" ShowPageSizer="True" UseSubmitBehaviour="False">
                               <Columns>
                                   <asp:TemplateField ShowHeader="False" meta:resourcekey="...">
                                       <ItemTemplate>
                                           <asp:ImageButton runat="server" CommandName="Select" CausesValidation="False" SkinID="uprowbutton"
                                               ToolTip="..." ID="ImgBtnSelect" meta:resourcekey="...">
                                           </asp:ImageButton>
                                       </ItemTemplate>
                                   </asp:TemplateField>
                                   ... Boundfields ...
                               </Columns>
                           </asp:Gridview>
                        ...
                    </asp:WizardStep>
                    ... 
    </asp:Wizard>
    </ContentTemplate>
</asp:UpdatePanel>

protected void Gridview1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    this.odsGasten.FilterExpression = searchText;
    this.Gridview1.DataBind();
    this.UpdtPnlDetail.Update();
}
+5
source share
3 answers

, .  , datatable, dt , dt gridview. .

0

, this.GridView1.DataBind() GridView1_PageIndexChanging, currentPageIndex , , ?

0

It sounds like you have a problem with the presentation in the presentation.

You need to make sure that a set of grid sources is set between Init and Load: either from the viewstate, or from the new binding.

0
source

All Articles