Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello!

I`m making a Board using gridview, but I have one problem.

I want to make a paging, and I only using Grid View basic paging.... from database(sql)

What I want to do is like this

<< < 1 2 3 4 5 > >>

<< is first, < is previous, 1 2 3 4 5 is numeric and 5 is max numeric count

and > is next, >> is last

Now I`m searching about this from the Internet.. I`m confusing how to use it....

So Please... somebody show me the right way to make it...

What I have tried:

Only using in basic paging like this
-- Html Code --
HTML
<asp:GridView ID="GridView1"
                 runat="server" 
                 CellPadding="4" 
                 ForeColor="#333333" 
                 GridLines="None" 
                 Width="862px" 
                 RowStyle-HorizontalAlign="Center" 
                 AutoGenerateColumns="False"    
                 DataKeyNames="BoardItemID" 
                 AllowPaging="True" 
                 PageSize="5" 
                 OnPageIndexChanging="GridView1_PageIndexChanging" 
                 ShowHeaderWhenEmpty="true" 
                 EmptyDataText="Data not found.">

-- Code Behind --
C#
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    GridView1.PageIndex = e.NewPageIndex;
    PutGridView();
}
Posted
Updated 10-Aug-16 22:02pm
v3

1 solution

Check my other similar solution it may help you guide to the right direction.

(Ignore the copying data part of the code, look at near the bottom of code sample for paging logic).

How to store specific rows from one dataset to another.[^]
 
Share this answer
 
Comments
RydenChoi 11-Aug-16 3:56am    
it`s not matched perfectly but I got some idea from your link

Thank you!! njammy
njammy 11-Aug-16 4:03am    
You're welcome. Please post your final solution sample when you get it for helping others in future.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900