I have an ASP page with a DDL box and a grid view associated with it. Everything is working great, except for a teeny problem.
Scenario:
I want to see the sales in the grid view based on the month selected from drop down list. Ex: when I select June 2010 from the ddl box, the sales for that month are correctly displayed in the grid view. I go to page 4 to look at some sales there and then
switch the month to August 2010 to see sales for that month instead. Here is the problem. When I switch the month, it show August 2010 sales, but stays in page 4 instead of going back/resetting back to page 1 of August 2010 sales.
How do I reset the grid view page back to the first page of August 2010 sales?
I am fairly new to ASP. If I have missed an imp. detail in this post, let me know and I will get that info. out there.
Thank you Pete. I did just that after I posted. At first I didn't even know what to look for in help and I finally figured that it was pageindex and found the same link you provided.
ramastl
0 Points
3 Posts
GridView page reset based on Drop Down List selection
Jan 03, 2011 08:41 PM|LINK
I have an ASP page with a DDL box and a grid view associated with it. Everything is working great, except for a teeny problem.
Scenario:
I want to see the sales in the grid view based on the month selected from drop down list. Ex: when I select June 2010 from the ddl box, the sales for that month are correctly displayed in the grid view. I go to page 4 to look at some sales there and then switch the month to August 2010 to see sales for that month instead. Here is the problem. When I switch the month, it show August 2010 sales, but stays in page 4 instead of going back/resetting back to page 1 of August 2010 sales.
How do I reset the grid view page back to the first page of August 2010 sales?
I am fairly new to ASP. If I have missed an imp. detail in this post, let me know and I will get that info. out there.
Thanks!
grid vew page reset
PeteNet
All-Star
81342 Points
11398 Posts
Re: GridView page reset based on Drop Down List selection
Jan 03, 2011 08:56 PM|LINK
set the Pageindex property to 0 every time you change the selection, the DDL has a SelectedIndexChanged event you could use.
Peter
bullpit
All-Star
21838 Points
4822 Posts
Re: GridView page reset based on Drop Down List selection
Jan 03, 2011 08:57 PM|LINK
You can set GridView's PageIndex property on your DropDownList's SelectedIndexChanged event.
Max
Let Me Google That For You!
ramastl
0 Points
3 Posts
Re: GridView page reset based on Drop Down List selection
Jan 04, 2011 02:28 PM|LINK
Thank you Pete. I did just that after I posted. At first I didn't even know what to look for in help and I finally figured that it was pageindex and found the same link you provided.
Rama
ramastl
0 Points
3 Posts
Re: GridView page reset based on Drop Down List selection
Jan 04, 2011 02:29 PM|LINK
Thanks for the infor Max. That's exactly what I did and it worked.