Developers blog, .NET, C#, VB.NET, ATLAS, AJAX, WWF, ORM, LINQ, ARCHITECTURE and more by Frank Kroondijk |
|
ProfileFrank KroondijkSoftware developerSoftware architectBlog profile
Links
Archives
200 feeds |
dinsdag, februari 07, 2006Extending GridView Pager with pagertemplate
Working with the asp:GridView control I wanted to show a more extended pager footer. You can use the PagerSettings to adjust a vew settings:
#pagersettings mode="NextPreviousFirstLast" firstpageimageurl="First.gif" previouspageimageurl="Prev.gif" nextpageimageurl="Next.gif" lastpageimageurl="Last.gif"# //replace # (sry, blogger stuff, and yeah yeah, I need to set up a propper blogsite..) But sometimes this isn´t enough. To gain more freedom on how to implement your pagerbar, you can make use of a pagertemplate. Notice the Panel, in this sample code I fill this panel with the pagecontrols I want (previous, first, all pages, next, last) Now we have to set the OnDataBound eventhandler: OnDataBound="gridAllPages_DataBound" This method will fill the pagerbar with everything you like. View the script here (dont´t forget to restore the script tags after Copy/Paste): http://www.overnight.nl/download/databoundscript.txt script in action: cheers, Frank Kroondijk http://dotnetpret.blogspot.com/ other ref: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/GrdDetView.asp
Comments:
Thanks a lot for this code that you put up there Frank. This was definately something I have been looking for quite a few days. Funny enough it never struck to me that we could use a panel and add link buttons to it in a for loop. Something new I learnt from your code today ... Cheers!
Nice stuff, found this out myself as well. But which control actually catches the Command event that reads the CommandName and CommandArgument from the pressed button? Not the gridview, at least not in my code...
Hi
I have done exactly the same thing myself so I was encouraged to find your code. It showed I was on the right track. The problem I am now facing is how to reuse my pager template and the code to handle the dynamic link creation but I don't know how to do it. I could put the grid in a user control but then I would know how to give the grid different columns on different pages. Have you come across this issue? thanks
Hi
How would you reuse your pager template and the code to create the dynamic links? If you put the grid into a user control, how would you be able to give the grid different columns on different pages for example? Perhaps you need something more sophisticated than a user control? thanks
Correctly your article helped me very much in my college assignment. Hats incorrect to you send, choice look forward in the direction of more cognate articles without delay as its sole of my favourite question to read.
Een reactie posten
<< Home |