Last post Oct 06, 2008 03:04 PM by jtlembke
Oct 01, 2008 09:03 PM|jtlembke|LINK
In a custom ListDetails page, when you make a selection in the FilterRepeater, how can you make the first record of the Gridview be selected and also refresh the DetailsView to match? I had though doing something like this would work in OnFilterSelectedIndexChanged,
but I get nothing..
GridView1.SelectedIndex = 0;
GridView1.Rows.RowState = DataControlRowState.Selected;
Oct 02, 2008 02:27 PM|jheyse|LINK
Try using the GridView.DataBound event instead.
This should be fired after the Filter changes the under lying datasource.
Oct 02, 2008 05:09 PM|jtlembke|LINK
Thanks, but that didn't work. Setting those in GridView1.Databound has no effect.
Does it work for you? I tried this on a freshly generated project and it still doesn't work.
Oct 05, 2008 11:09 PM|davidebb|LINK
Please try adding the following code to OnGridViewDataBound:
GridView1.SelectedPersistedDataKey = GridView1.DataKeys;
PS: you'll probably need an extra check for the case where there is no data, but you get the idea
Oct 06, 2008 03:04 PM|jtlembke|LINK
YES! Perfect. Thanks yet again, David!