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

RadGrid and DetailTables

5 Answers 866 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Regula
Top achievements
Rank 1
Regula asked on 10 Dec 2013, 02:55 PM
Hi all!

I've a RadGrid with a detail table collapsed by default.

I noticed that my fist click to expand the detail table doesn't works. No matter where is the first click, I just have to click in the expand one type in any row. That click doesn't works but all following clicks do work.

I debugged and notice that a postback is made in the first click, thus I don't understand why, even with a postback, the grid doesn't update showing the detail table.

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 12 Dec 2013, 06:07 AM
Hi Regula,

Here is a sample code snippet that i tried which works fine at my side. Please have a look and if this doesn't help, please provide your full code snippet.

ASPX:
<telerik:RadGrid ID="RadGrid1" ShowStatusBar="true" DataSourceID="SqlDataSource1" runat="server" AutoGenerateColumns="False" PageSize="7" AllowSorting="True" AllowMultiRowSelection="False" AllowPaging="True" GridLines="None">  
    <MasterTableView DataSourceID="SqlDataSource1" DataKeyNames="CustomerID" AllowMultiColumnSorting="True"
        HierarchyLoadMode="Client" EditMode="InPlace" CommandItemDisplay="Top" Name="Parent">
        <DetailTables>
            <telerik:GridTableView DataKeyNames="OrderID" DataSourceID="SqlDataSource2" runat="server"
                AllowSorting="true" Name="Child" AllowPaging="true" PageSize="2" EditMode="InPlace"
                HierarchyLoadMode="Client" CommandItemDisplay="Top">
                <ParentTableRelation>
                    <telerik:GridRelationFields DetailKeyField="CustomerID" MasterKeyField="CustomerID">
                    </telerik:GridRelationFields>
                </ParentTableRelation>
                <NoRecordsTemplate>
                    <asp:Label ID="NoRecordLabel" runat="server" />
                </NoRecordsTemplate>
                <Columns>
                    <telerik:GridEditCommandColumn UniqueName="EditCommandColumn">
                    </telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn SortExpression="OrderID" HeaderText="OrderID" HeaderButtonType="TextButton"
                        DataField="OrderID" UniqueName="OrderID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="OrderDate" HeaderText="Date Ordered" HeaderButtonType="TextButton"
                        DataField="OrderDate" UniqueName="OrderDate" DataFormatString="{0:D}">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Freight" HeaderText="Freight" HeaderButtonType="TextButton"
                        DataField="Freight" UniqueName="Freight">
                    </telerik:GridBoundColumn>
                </Columns>
            </telerik:GridTableView>
        </DetailTables>
        <Columns>
            <telerik:GridEditCommandColumn UniqueName="EditCommandColumn">            
            </telerik:GridEditCommandColumn>
            <telerik:GridBoundColumn SortExpression="CustomerID" HeaderText="CustomerID" HeaderButtonType="TextButton"
                DataField="CustomerID" UniqueName="CustomerID">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn SortExpression="ContactName" HeaderText="Contact Name" HeaderButtonType="TextButton"
                DataField="ContactName" UniqueName="ContactName">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn SortExpression="CompanyName" HeaderText="Company" HeaderButtonType="TextButton"
                DataField="CompanyName" UniqueName="CompanyName">
            </telerik:GridBoundColumn>         
        </Columns>
    </MasterTableView>  
</telerik:RadGrid>
<asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:Northwind_newConnectionString3 %>"
    ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM Customers"
    runat="server"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" ConnectionString="<%$ ConnectionStrings:Northwind_newConnectionString3 %>"
    ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM Orders Where CustomerID = @CustomerID"
    runat="server">
    <SelectParameters>
        <asp:SessionParameter Name="CustomerID" SessionField="CustomerID" Type="string">
        </asp:SessionParameter>
    </SelectParameters>
</asp:SqlDataSource>

Thanks,
Shinu
0
Regula
Top achievements
Rank 1
answered on 12 Dec 2013, 10:18 AM

Hi Shinu,

Thanks for your feedback, here is the code. I've alo tried to remove the RadAjaxManagerProxy, ie, "desajaxify" and problem problem keeps happening.


<telerik:RadAjaxManagerProxy ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="gv1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="gv1" LoadingPanelID="RadAjaxLoadingPanel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>
.
.
.
.
<telerik:RadGrid ID="gv1" runat="server" AllowFilteringByColumn="false"
                AllowPaging="true" AllowSorting="true" AutoGenerateColumns="false" EnableAJAX="true"
                 GridLines="Horizontal" OnItemCreated="gv1_ItemCreated"
                PageSize="10"  Width="100%" DataSourceID="DataSourceMain"
                OnItemCommand="gv1_ItemCommand" 
                onitemdatabound="gv1_ItemDataBound">                   
                <MasterTableView AllowMultiColumnSorting="false" CommandItemDisplay="Top" DataKeyNames="ID,IDProject"
                    GridLines="None" ShowFooter="true" Name="Adiantamentos">
                    <Columns>                           
                        <telerik:GridBoundColumn AllowFiltering="false" AllowSorting="True" DataField="Data"
                            HeaderText="Data" SortExpression="Data" UniqueName="Data" ItemStyle-Wrap="false">
                        </telerik:GridBoundColumn>
                         <telerik:GridBoundColumn AllowFiltering="false" AllowSorting="True" DataField="ID"
                            HeaderText="ID.Adia." SortExpression="ID" UniqueName="ID" Visible="true" HeaderTooltip="ID">
                            <HeaderStyle Width="20px" />
                        </telerik:GridBoundColumn>                         
                        <telerik:GridBoundColumn AllowFiltering="false" AllowSorting="false" DataField="RefProject"
                            HeaderText="RefProject" SortExpression="RefProject" UniqueName="RefProject">
                            <HeaderStyle Width="15%" />
                        </telerik:GridBoundColumn>
                          <telerik:GridBoundColumn AllowFiltering="false" AllowSorting="false" DataField="IDProject"
                            HeaderText="ID Prj." HeaderTooltip="ID do Project"  SortExpression="IDProject" UniqueName="IDProject" Visible="true">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn AllowFiltering="false" AllowSorting="True" DataField="Amount"
                            HeaderText="Amount" SortExpression="Amount" UniqueName="Amount" DataFormatString="{0:N2}">
                            <HeaderStyle Width="10%" />
                        </telerik:GridBoundColumn>                            
                    </Columns>
                      <DetailTables>
                        <telerik:GridTableView Width="100%" DataSourceID="dataSource2" runat="server"
                            DataKeyNames="ID" CommandItemDisplay="None" AllowPaging="false" AllowSorting="false"
                            Name="Details">
                            <ParentTableRelation>
                                <telerik:GridRelationFields DetailKeyField="IDAd" MasterKeyField="ID" />
                            </ParentTableRelation>
                             
                            <Columns>
                                <telerik:GridBoundColumn AllowFiltering="false" AllowSorting="True" DataField="IDAd"
                                    HeaderText="IDAd" SortExpression="IDAd" UniqueName="IDAd"
                                    Visible="false">
                                    <HeaderStyle Width="20px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn AllowFiltering="false" AllowSorting="True" DataField="Date"
                                    HeaderText="Date" SortExpression="Date" UniqueName="Date"
                                    DateFormatString="{0:dd-MM-yyyy}">
                                    <HeaderStyle Width="80px" />
                                </telerik:GridBoundColumn>
                                  <telerik:GridBoundColumn AllowFiltering="false" AllowSorting="True" DateField="IDRec"
                                    HeaderText="ID Rec." HeaderTooltip="ID Rec" SortExpression="IDRec" UniqueName="IDRec" Visible="true">
                                    <HeaderStyle Width="20px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn AllowFiltering="false" AllowSorting="True" DateField="ID"
                                    HeaderText="ID Comp." SortExpression="ID" UniqueName="ID" Visible="false">
                                    <HeaderStyle Width="20px" />
                                </telerik:GridBoundColumn>
                                
                                <telerik:GridBoundColumn AllowFiltering="false" AllowSorting="True" DateField="Amount"
                                    HeaderText="Amount" SortExpression="Amount" UniqueName="Amount" DateFormatString="{0:N2}"
                                    HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right">
                                    <HeaderStyle HorizontalAlign="Right" Width="50px" />
                                    <ItemStyle HorizontalAlign="Right" />
                                </telerik:GridBoundColumn>
                            </Columns>
                        </telerik:GridTableView>
                    </DetailTables>
                    <CommandItemTemplate>
                        <table  cellspacing="0" cellpadding="4" border="0" width="100%">
                            <tr>
                                <td align="right">
                                   <telerik:RadButton ID="ExportToExcelButton" Text="export" runat="server" CommandName="ExportExcel" OnClientClicked="Export2Excel"  CausesValidation="False"  >                        
                                    </telerik:RadButton>
                                </td>
                            </tr>
                        </table>
                    </CommandItemTemplate>
                    <CommandItemStyle HorizontalAlign="Right" />
                </MasterTableView>
                <ClientSettings>
                </ClientSettings>
            </telerik:RadGrid>
            <asp:ObjectDateSource ID="DateSourceMain" runat="server" EnablePaging="True"
                OnSelecting="DateSourceMain_Selecting" SelectCountMethod="GetListCount"
                SelectMethod="GetList" SortParameterName="sortType" TypeName="BLLMain">
                <SelectParameters>
                    <asp:ControlParameter ControlID="searchIDProject" DefaultValue="" Name="idProject"
                        PropertyName="Text" Type="Int32" />                        
                </SelectParameters>
            </asp:ObjectDateSource>
            <asp:ObjectDateSource ID="DateSource2" runat="server" EnablePaging="True"
                  SelectCountMethod="GetListCount"
                SelectMethod="GetList" SortParameterName="sortType" TypeName="BLLDetail">
                <SelectParameters>
                    <asp:SessionParameter Name="idadia" SessionField="ID" Type="Int32" />
                    <asp:Parameter Name="idProject" Type="Int32" />
                    <asp:Parameter Name="idProject2" Type="Int32" />                      
                </SelectParameters>
            </asp:ObjectDateSource>
0
Maria Ilieva
Telerik team
answered on 13 Dec 2013, 12:35 PM
Hi Vasco,

In case you are using the VS 2013 "Browser Link" feature, note that a known issue with Hierarchy Grid is introduced in such scenarios. See the sticky thread below for more information on this matter:

http://www.telerik.com/community/forums/aspnet-ajax/grid/the-new-browser-link-feature-in-vs-2013-is-causing-an-error-when-detailtable-of-hierarchy-radgrid-is-expanded.aspx



Regards,
Maria Ilieva
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Regula
Top achievements
Rank 1
answered on 17 Dec 2013, 11:54 AM
Thanks Shinu for the feedback.

I'm not using "Browser Link". This issue I have in both versions of my site one in VS2010 and the newest in VS2012.

Thanks
0
Maria Ilieva
Telerik team
answered on 20 Dec 2013, 09:42 AM
Hello Vasco,

In case none of the provided solutions help it will be bets if you could open a regular support ticket and send us sample runnable application which demonstrates the issue. Thus we will be able to debug it locally and advise you further.

Regards,
Maria Ilieva
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Regula
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Regula
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or