-
August 20th, 2009, 08:49 AM
#1
gridview paging format Problem
Hi All,
I'm using a gridview control with paging. I'm having difficulty getting exactly what I want with the formatting for paging. i.e. I can get
Next Previous
1,2,3,4 .....
at the bottom of the grid for paging, but I cannot get
<previous 1,2,3,4,5 Next>
Type formatting, does anyone know how to do this.
If you find my answers helpful, dont forget to rate me
-
August 27th, 2009, 09:11 AM
#2
Re: gridview paging format Problem
I don't know if it is possible to modify the default pager settings in GridView, but you can manually create a pager for a GridView.
1. Override Render() function of the GridView
2. Generate the Hyperlinks or LinkButtons, to indicate your Previous, Page Number, Next command
3. Put the following script in the onClick event
LinkButton1.OnClientClick = "__doPostBack('" + this.ClientID.Replace("_", "$") + "','Page$" + n.ToString() + "')";
4. Render the controls using the LinkButton1.RenderControl(writer) command.
where n is the variable indicating the Page Number.
Step 3 is quite trickly instead, becauase the GridView will accept the Page$n in the event argument of a post back, and then switch the page number based on it.
You will discover it after inspecting how the page number works in ordinary paged gridview.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|