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

Expand all items on page load

1 Answer 188 Views
Grid
This is a migrated thread and some comments may be shown as answers.
A
Top achievements
Rank 1
A asked on 16 Mar 2015, 07:13 PM
Anyone,
I am using a RadGrid that contains one DetailTable as in the below code. I am binding the datasource for the grid in the NeedDataSource Event (need to do this way). I need to Expand all the items to show up the details table, on the page load (first time load); i am not sure when to expand the items. I tried doing it on the NeedDataSource event, but it doesn't work.

Please note: I have a asp button on the page for collapsing all the grid items. So i am unable to use the PreRender event as well. 

Can someone please suggest how do i go about this scenario?


<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False"
        AllowSorting="False" AllowMultiRowSelection="False" AllowPaging="False" OnNeedDataSource="RadGrid1_NeedDataSource"
        OnDetailTableDataBind="RadGrid1_DetailTableDataBind" Skin="Default">       
        <MasterTableView DataKeyNames="col1" ExpandCollapseColumn-ButtonType="PushButton">
            <DetailTables>
                <telerik:GridTableView Name="detailGrid" Width="95%" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Center">
                    <Columns>
                        <telerik:GridBoundColumn HeaderText="col1" HeaderButtonType="TextButton" DataField="col1" />
                        <telerik:GridBoundColumn HeaderText="col2" HeaderButtonType="TextButton" DataField="col2" />                        
                    </Columns>
                </telerik:GridTableView>
            </DetailTables>
            <Columns>
.....

1 Answer, 1 is accepted

Sort by
0
A
Top achievements
Rank 1
answered on 16 Mar 2015, 07:24 PM
Thanks! I found the solution. By checking (!IsPostback) on prerender event, solves my purpose!
Tags
Grid
Asked by
A
Top achievements
Rank 1
Answers by
A
Top achievements
Rank 1
Share this question
or