Click here to Skip to main content
15,920,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using a gridview/formview to function as master/detail. The gridview and formview are bound to the same datasource. There is a menu control that controls which formview control to show. Initially, I am setting the selectedindex of the gridview = 0 and displaying the associated formview control (the datasource has 3 records, formview.PageCount = 3). This works without issues. However, when I select another record the formview.PageCount = 3, the formview is populated with the data, once I click another menu item and return to the one previously clicked the formview.PageCount = 1 and the formview.PageIndex = 0;

if (menuItm.Selected = "Status Info")
{
int thisRow = theGrid.SelectedIndex;
if (theForm.PageIndex != theGrid.SelectedIndex)
{
theForm.PageIndex = theGrid.SelectedIndex;
gvwtheGrid_SelectedIndexChanged(theGrid, null)
}

//there is code to show the view which contains the formview
//theForm is set to visible.

How can I persist the Form.PageIndex once it has been set?

Thanks,
Posted
Updated 27-May-14 12:51pm
v2
Comments
DamithSL 27-May-14 21:19pm    
can you update the question with page load method code?

1 solution

Because the page is getting reloaded, to persist pageindex value, you have use a technique like hidden field / querystring to save that value and on load set selected index to that value.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900