locked
changing the name of gridview page link RRS feed

  • Question

  • User186897 posted

    Hello

    I have a gridview which has enable paging option which show 1 ,2 down the gridview, can I change the name '1' as Page1 and stuff, how do I do this?

    Friday, June 24, 2016 9:06 AM

Answers

  • User-271186128 posted

    Hi Lexi85,

    You can refer to the following code: Use a Repeater control to display the page number:

               <asp:GridView ID="grdDemo" runat="server" AutoGenerateColumns="False" DataKeyNames="CategoryID">
                    <Columns>
                        <asp:BoundField DataField="CategoryID" HeaderText="CategoryID" InsertVisible="False" ReadOnly="True" SortExpression="CategoryID" />
                        <asp:BoundField DataField="CategoryName" HeaderText="CategoryName" SortExpression="CategoryName" />
                        <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
                    </Columns>
                </asp:GridView>
                <asp:Repeater ID="rptPager" runat="server">
                    <ItemTemplate>
                        <asp:LinkButton ID="lnkPage" runat="server" Text='<%#string.Format("page{0} ", Eval("Text")) %>' CommandArgument='<%#Eval("Value") %>' Enabled='<%#Eval("Enabled") %>'
                            OnClick="lnkPage_Click" ForeColor="#267CB2" Font-Bold="true" />
                    </ItemTemplate>
                </asp:Repeater>

    More details, see: http://www.aspsnippets.com/Articles/ASPNet-GridView-Custom-Paging-with-PageSize-Change-Dropdown.aspx

    Best regards,
    Dillion

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 24, 2016 9:53 AM