This is a migrated thread and some comments may be shown as answers.

expand/collapse detail grid server-side

1 Answer 216 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
Albert Shenker asked on 24 Feb 2009, 08:59 PM
I have a hierarchical grid with server-side detail loading. I notice when the detail grid is expanded or collpased, the grid causes an ajax update, or postback (dependingon if it is ajaxified). I'm not sure why it would do this for collapse, but this behavior is ok. What I would like to do is "refresh" the data in the detail table by collapsing and re-expanding it server-side, like in response to a button click. First off, is there a propoerty that gets a reference tothe current;y expanded row? If not, I imagine I can store a value during the DetailTableDataBind event. Secondly, are there methods which would allow me to collapse and re-expand the selected detail? One other option is to reload the grid data alltogether and then simply "expand" the previously selected detail. This would still require some sort of server-side expand method

If all of this is not possible, or even if it is, can someone recommend a better way to "Refresh" the detail table in response to a button click.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 25 Feb 2009, 01:46 PM
Hello Albert,

Try placing both the Button and RadGrid controls in an AjaxPanel or ajaxifying the controls using an AjaxManager. Then you can try out the following code to get the item that is expanded on the button click event and collapse it.
cs:
protected void Button3_Click1(object sender, EventArgs e)  
    {  
      foreach (GridDataItem dataItem in RadGrid2.Items)  
        {  
            if (dataItem.Expanded) // condition to find the item that is expanded 
            {  
                dataItem.Expanded = false; // collapse the expanded item 
            }  
       }  
    }  

Thanks
Princy.
Tags
Grid
Asked by
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
Answers by
Princy
Top achievements
Rank 2
Share this question
or