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

[Solved] Problem with RadGrid (ExpandCollapse)

2 Answers 200 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Karl Rohrbach
Top achievements
Rank 1
Karl Rohrbach asked on 16 Mar 2010, 10:04 PM
I am having an issue with expanding a second detailtable in a RadGrid.  Whenever I try and expand the second level, the whole RadGrid collapses.  This also happens when expanding other rows from the MasterTableView.  I included snips below of the code.  Any help would be greatly appreciated.  In the code behind, please note that the GetSubmissionResults and the GetSubmissions are webservice calls. 

Thanks in advance.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server"   
            GridLines="None" AutoGenerateColumns="False" PageSize="20"   
            MasterTableView-Width="100%"   
            OnDetailTableDataBind="URLGrid_DetailTableDataBind" 
            Visible="True">  
    <MasterTableView ItemStyle-Width="100%" NoMasterRecordsText="No Results Found"   
            NoDetailRecordsText="No ResultsFound" Visible="true"   
            datakeynames="SubmissionGroupID" ExpandCollapseColumn-ItemStyle-BackColor="#CCCCCC">  
        <DetailTables> 
                <telerik:GridTableView DataKeyNames="SubmissionID" runat="server" Width="100%" Name="caseURLs">  
                    <DetailTables> 
                        <telerik:GridTableView runat="server" Name="caseDetails">  
                            <expandcollapsecolumn visible="True">  
                            </expandcollapsecolumn> 
                     <ParentTableRelation> 
                        <telerik:GridRelationFields DetailKeyField="SubmissionID" MasterKeyField="SubmissionID" /> 
                    </ParentTableRelation> 
                            <Columns> 
                            <telerik:GridBoundColumn DataField="SubmissionID" Visible="false">  
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn AllowSorting="false" DataField="SubmissionID"   
                                HeaderText="ID" ShowSortIcon="false" UniqueName="column">  
                            </telerik:GridBoundColumn> 
                            </Columns> 
                        </telerik:GridTableView>                      
                    </DetailTables> 
                 <expandcollapsecolumn visible="True"></expandcollapsecolumn> 
                <Columns> 
                        <telerik:GridBoundColumn AllowSorting="false" DataField="SubmissionID"   
                            HeaderText="ID" ShowSortIcon="false" UniqueName="column">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn AllowSorting="false" DataField="AbsoluteUrl"   
                            HeaderText="URL" ShowSortIcon="false" UniqueName="column">  
                        </telerik:GridBoundColumn> 
                </Columns> 
            </telerik:GridTableView> 
        </DetailTables> 
 
                <expandcollapsecolumn visible="True">  
                </expandcollapsecolumn> 
            <Columns> 
                <telerik:GridBoundColumn AllowSorting="false" DataField="SubmissionGroupID"   
                    HeaderText="Group" ShowSortIcon="false" UniqueName="column">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn AllowSorting="false" DataField="Baseline"   
                    HeaderText="Baseline" ShowSortIcon="false" UniqueName="column">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn AllowSorting="false" DataField="Description"   
                    HeaderText="Description" ShowSortIcon="false" UniqueName="column">  
                </telerik:GridBoundColumn> 
            </Columns> 
              
              
            <NoRecordsTemplate><div align="center">No Results Found</div></NoRecordsTemplate>  
            <expandcollapsecolumn visible="True">  
                <ItemStyle BackColor="#CCCCCC" /> 
            </expandcollapsecolumn> 
 
 
        <ItemStyle Width="100%" /> 
    </MasterTableView>      
    </telerik:RadGrid> 

Code Behind <snip> :

protected void URLGrid_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)  
    {  
        GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;  
          
        switch (e.DetailTableView.Name) {  
 
            case "caseURLs": {  
            int groupID = (int)dataItem.GetDataKeyValue("SubmissionGroupID");  
            submissionView = WebServiceClient.GetSubmissions(groupID);  
            e.DetailTableView.DataSource = submissionView;  
                break;  
            }  
 
            case "caseDetails": {  
                int detailsID = (int)dataItem.GetDataKeyValue("SubmissionID");  
            submissionResults = WebServiceClient.GetSubmissionResults(detailsID, ResultType.Passed);  
            e.DetailTableView.DataSource = submissionResults;  
                break;  
            }  
        }   
    }  
 

2 Answers, 1 is accepted

Sort by
0
Karl Rohrbach
Top achievements
Rank 1
answered on 17 Mar 2010, 04:58 PM
After further examination and work, it appears that selecting to expand a row in RadGrid causes a Page.PostBack.  I never had to check for Post.Back in an expandable RadGrid.

I have used the same RadGrid code in other environments.  Anyone have an idea why a RadGrid ExpandCollapse would cause a PostBack? 

Please note (previous post) that my data in the drill down comes from different calls to a web service. 

Thanks in advance for the help.
0
louis chan
Top achievements
Rank 1
Iron
answered on 17 Mar 2010, 05:56 PM
hi Karl,
u may need to set the expand mode to client, then it will not post back.
Tags
Grid
Asked by
Karl Rohrbach
Top achievements
Rank 1
Answers by
Karl Rohrbach
Top achievements
Rank 1
louis chan
Top achievements
Rank 1
Iron
Share this question
or