| | |
set a dynamic page size for gridview?
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2007
Posts: 14
Reputation:
Solved Threads: 0
is there a way to set a set a dynamic page size for gridview?
for instance, i am choosing 10 from the properites window for PageSize, but I would like to have a form field on the page where the user can type the number of records they would like to show per page, and have the gridview reflect that...
for instance, i am choosing 10 from the properites window for PageSize, but I would like to have a form field on the page where the user can type the number of records they would like to show per page, and have the gridview reflect that...
ASP.NET Syntax (Toggle Plain Text)
protected void ddPageSize_SelectedIndexChange(object sender, EventArgs e) { GridView1.PageSize = Convert.ToInt32(ddPageSize.SelectedValue); //Re-bind the grid however you're doing that, in a seperate function //if you're sensible. }
•
•
Join Date: Mar 2007
Posts: 14
Reputation:
Solved Threads: 0
I apparen;ty jumped the gun. The problem I have (and this is with and without the dynamic setting for the paging) is as follows:
I have a strange issue. I have a GridView that displays partial data from a table. When you click the "Select" button, I have a form view that shows the entire record. I have paging set to 5. Everything works fine when I view the first set of records. The problem is, when I click the 2nd page, or 3rd, or 4th page, and then click the "Select", it is showing me the first pages records. IE, the gridview is showing in alphabetical order, and when I am on page 10 looking at the T's, and click select, i see the first record, for "A". when I click the second record, I see "A" as well.
No matter what page I am on, it is only using the values from the first view for the select buttons (- I really hope that makes sense...)
I have a strange issue. I have a GridView that displays partial data from a table. When you click the "Select" button, I have a form view that shows the entire record. I have paging set to 5. Everything works fine when I view the first set of records. The problem is, when I click the 2nd page, or 3rd, or 4th page, and then click the "Select", it is showing me the first pages records. IE, the gridview is showing in alphabetical order, and when I am on page 10 looking at the T's, and click select, i see the first record, for "A". when I click the second record, I see "A" as well.
No matter what page I am on, it is only using the values from the first view for the select buttons (- I really hope that makes sense...)
the problem is most likely you are using AutoPostBack on the ASP button object which will reload the page you are on and reset it to the default, which is the first page. The way I usually work around this is my creating my own form button object and use it to complete the task. you might want to think about creating a Refresh button along side the Select, or removing the Select altogether and replacing it with a Form button instead of a ASP object. this may or way not work with what you are trying to do, but it is all I can think of. Hope it helps.
- mike mclennan
![]() |
Similar Threads
- Page size wider than setup (Windows Software)
- How to set html page size attributes (HTML and CSS)
- How to create Dynamic Page Break in HTML? (JavaScript / DHTML / AJAX)
- Can't set home page in Internet Options (Web Browsers)
Other Threads in the ASP.NET Forum
- Previous Thread: how to pass values to called function
- Next Thread: Problem in Redirecting a .aspx Page
| Thread Tools | Search this Thread |
.net 2.0 3.5 activexcontrol advice ajax alltypeofvideos asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox class click commonfunctions compatible confirmationcodegeneration content contenttype control countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock deployment development dgv dropdownlist dropdownmenu dynamic edit embeddingactivexcontrol expose findcontrol flash flv formatdecimal forms formview gridview homeedition iframe iis javascript jquery list login menu microsoft mono mssql multistepregistration nameisnotdeclared numerical objects order panelmasterpagebuttoncontrols problem ratings rotatepage save schoolproject search security serializesmo.table silverlight smartcard sql sqlserver2005 ssl suse textbox tracking unauthorized validation vb.net video virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt webdevelopment webservice wizard xml youareanotmemberofthedebuggerusers






