Answered by:
How can I make a custom paging with GridView?

Question
-
User-1355475649 posted
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(mssql)
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 Page 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...Tuesday, August 9, 2016 5:16 AM
Answers
-
User61956409 posted
Hi SuperRyden,
You could refer to the following articles to implement Custom Paging.
http://www.aspsnippets.com/Articles/ASPNet-GridView-Custom-Paging-with-PageSize-Change-Dropdown.aspx
http://www.codeproject.com/Articles/410733/Custom-paging-with-ASP-NET-GridView
Best Regards,
Fei Han
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, August 10, 2016 5:59 AM
All replies
-
User603616845 posted
Hi,
How can I make a custom paging with GridView?There are lots of articles available on the web you can search for your best.. I have search a article for you where step by step implementation of custom paging in gridview.
you can modify some logic for you.
hope this will help you.
thanks
Tuesday, August 9, 2016 5:27 AM -
Tuesday, August 9, 2016 5:34 AM
-
User61956409 posted
Hi SuperRyden,
You could refer to the following articles to implement Custom Paging.
http://www.aspsnippets.com/Articles/ASPNet-GridView-Custom-Paging-with-PageSize-Change-Dropdown.aspx
http://www.codeproject.com/Articles/410733/Custom-paging-with-ASP-NET-GridView
Best Regards,
Fei Han
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, August 10, 2016 5:59 AM -
User-1355475649 posted
Thank you Fei Han! You are my boss!!! Your links gave me a solution!!!
Thursday, August 11, 2016 8:21 AM -
User-1355475649 posted
Thank you Mukesh Kumar. It`s not matched perfectly but you showed me the way to solve the problem!!
Friday, August 12, 2016 4:55 AM -
User-1355475649 posted
Thank you mike4u. I learned how to make custom paging from your link!!
Friday, August 12, 2016 4:56 AM -
User-1355475649 posted
Can I add more question??
Actually I already made a stored procedure to use show grid view.
Of course, it doesn't have custom paging function.
So I tried to mix a stored procedure that you gave me(http://www.aspsnippets.com/Articles/Custom-Paging-in-ASPNet-GridView-using-MySql-Stored-Procedure.aspx)
But It's really hard and confused...
I posted mixed Stored Procedure below, please teach me how to change it...
It works well but the notice is not placed on the top of list..just aligned indexNo..
ALTER PROCEDURE [dbo].[TestCustomPaging] @BoardID int --FK(PK in tb_BoardMaster, I have 3 Boards) , @PageIndex int , @PageSize int , @RecordCount int output AS BEGIN SET NOCOUNT ON; SELECT ROW_NUMBER() OVER ( ORDER BY I.BoardItemID desc )AS indexNO , I.BoardItemID -- PK , I.BoardTitle , I.UserName , I.BoardRegDate , I.BoardHit , I.BoardNotice -- To verify notice or not(default value is N(not notice)) , (SELECT COUNT(FileID) FROM tb_AttachedFiles A WHERE A.BoardItemID = I.BoardItemID) AS FileCount INTO #Result FROM tb_BoardItem I WHERE BoardID = @BoardID ORDER BY I.BoardNotice DESC, indexNO DESC SELECT @RecordCount = COUNT(*) FROM #Result SELECT * FROM #Result WHERE indexNO BETWEEN (@PageIndex -1) * @PageSize +1 AND (((@PageIndex -1) * @PageSize +1) + @PageSize) -1 DROP TABLE #Result END
Friday, August 12, 2016 5:41 AM -
User364480375 posted
put this in separate thread
Friday, August 12, 2016 5:43 AM -
User-1355475649 posted
posted it sql thread. http://forums.asp.net/p/2101306/6072831.aspx?p=True&t=636065603933117165
Friday, August 12, 2016 8:01 AM