locked
How do I make FilterRepeater selection update DetailsView RRS feed

  • Question

  • User-1425666379 posted

    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[0].RowState = DataControlRowState.Selected;
    DetailsView1.DataBind();
     
     
    Wednesday, October 1, 2008 9:03 PM

Answers

  • User1641955678 posted

    Hi Jeff,

    Please try adding the following code to OnGridViewDataBound:

        GridView1.SelectedPersistedDataKey = GridView1.DataKeys[0];
        DetailsView1.DataBind();

    thanks,
    David

    PS: you'll probably need an extra check for the case where there is no data, but you get the idea

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, October 5, 2008 11:09 PM

All replies

  • User1024101778 posted

    Try using the GridView.DataBound event instead.

    This should be fired after the Filter changes the under lying datasource.

    Thursday, October 2, 2008 2:27 PM
  • User-1425666379 posted

    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.

     

    Jeff

    Thursday, October 2, 2008 5:09 PM
  • User1641955678 posted

    Hi Jeff,

    Please try adding the following code to OnGridViewDataBound:

        GridView1.SelectedPersistedDataKey = GridView1.DataKeys[0];
        DetailsView1.DataBind();

    thanks,
    David

    PS: you'll probably need an extra check for the case where there is no data, but you get the idea

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, October 5, 2008 11:09 PM
  • User-1425666379 posted

    YES! Perfect. Thanks yet again, David!

    Jeff

    Monday, October 6, 2008 3:04 PM