0 Comments

When using ajax and the Telerik RadGrid control and a DropDownlistbox in the RadGrid, a postback or AJAX postback will automatically collapse the detailtableviews in the mastertableview. If you want to keep the the current detailview expanded use:


      // Get current ScoreListId from DropDownList
      DropDownList ddl = ((DropDownList)sender);

      // code ….

      // Update only the current ScoreList in the RadGrid with the updated data, by fireing the RadGrid_NeedDataSource event
      ((GridDataItem)ddl.Parent.Parent).OwnerTableView.Rebind();

      // The rebind will collapse the current griditem, so expand it again.
      ((GridDataItem)ddl.Parent.Parent).OwnerTableView.ParentItem.Expanded = true;

One Reply to “Expand Collapse DetailView in RadGrid from C# code”

  1. Thanks for this. Such a simple solution but exactly what I needed!

    In fact, all I needed was …

    protected void RadGrid3_ItemCommand(object sender, GridCommandEventArgs e)
    {

    e.Item.OwnerTableView.Rebind();
    e.Item.OwnerTableView.ParentItem.Expanded = true;

    ..
    }

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts