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

Loop datagriditem in DetailTable not expanded

3 Answers 153 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matteo Beretta
Top achievements
Rank 1
Matteo Beretta asked on 17 Aug 2010, 04:04 PM

hi, i have a grid with detailtable, loading in detailtablebind event, when i push a button i want loop all selected row in detail table also not expanded...
post some code...

<telerik:RadGrid runat="server" ID="rgrFatturazione" Skin="Vista"
                   AllowPaging="True" AllowSorting="True" GridLines="None" 
                   style="margin-top: 200px; margin-left:27px;"  Width="900px" 
                   ShowGroupPanel="True" oncolumncreated="rgrFatturazione_ColumnCreated" AllowMultiRowSelection="true"
                   ondetailtabledatabind="rgrFatturazione_DetailTableDataBind" 
               onitemcommand="rgrFatturazione_ItemCommand" 
               onitemdatabound="rgrFatturazione_ItemDataBound">
                   <GroupingSettings CaseSensitive="false" />
                   <PagerStyle Mode="NumericPages"/>
                   <ClientSettings>
                   <Selecting  AllowRowSelect="true"/>
                   </ClientSettings>
                   <MasterTableView ShowHeadersWhenNoRecords="true" >
                        <DetailTables>
                           <telerik:GridTableView Name="Commessa" Width="100%">
                               <Columns>
                                      <telerik:GridBoundColumn UniqueName="colCustomer" HeaderText="Cliente" Visible="false">
                                       </telerik:GridBoundColumn>
                                       <telerik:GridBoundColumn UniqueName="colComm" HeaderText="Commessa" Visible="false">
                                       </telerik:GridBoundColumn>
                                       <telerik:GridClientSelectColumn UniqueName="checkCom"/>
                               </Columns>
                               <DetailTables>
                                   <telerik:GridTableView Name="Rapportini" Width="100%">
                                       <Columns>
                                                   <telerik:GridBoundColumn UniqueName="colCustomer" HeaderText="Cliente" Visible="false">
                                                   </telerik:GridBoundColumn>
                                                   <telerik:GridBoundColumn UniqueName="colComm" HeaderText="Commessa" Visible="false">
                                                   </telerik:GridBoundColumn>
                                                   <telerik:GridTemplateColumn UniqueName="colCheckRap" ItemStyle-HorizontalAlign="Center" AllowFiltering="false">
                                                       <ItemTemplate>
                                                           <asp:CheckBox runat="server" ID="checkRap" />
                                                       </ItemTemplate>
                                                   </telerik:GridTemplateColumn>                                                                                                     
                                                   <telerik:GridTemplateColumn UniqueName="colView" ItemStyle-HorizontalAlign="Center" AllowFiltering="false">
                                                       <ItemTemplate>
                                                           <asp:Image runat="server" ID="linkView" ImageUrl="~/images/Zoom.png">
                                                           </asp:Image>
                                                           <telerik:RadToolTip runat="server" Width="300" Height="300" RenderInPageRoot="true" ShowEvent="OnMouseOver"
                                                                   HideEvent="ManualClose" HideDelay="2" ID="Tooltip" Position="TopRight" Animation="Resize"
                                                                   RelativeTo="Element" >
                                                           </telerik:RadToolTip>
                                                       </ItemTemplate>
                                                   </telerik:GridTemplateColumn>
                                                   <telerik:GridTemplateColumn UniqueName="colView" ItemStyle-HorizontalAlign="Center" AllowFiltering="false">
                                                       <ItemTemplate>
                                                           <asp:LinkButton runat="server" ID="linkRappo" Text="Rapportino" CommandName="Rapportino">
                                                           </asp:LinkButton>
                                                       </ItemTemplate>
                                                   </telerik:GridTemplateColumn>
                                       </Columns>
                                   </telerik:GridTableView>
                               </DetailTables>
                           </telerik:GridTableView>
                   </DetailTables>                  
                   <Columns>
                           <telerik:GridBoundColumn UniqueName="colCustomer" HeaderText="Cliente" Visible="false">
                           </telerik:GridBoundColumn>
                           <telerik:GridBoundColumn UniqueName="colComm" HeaderText="Commessa" Visible="false">
                           </telerik:GridBoundColumn>
                   </Columns>
                   </MasterTableView>
           </telerik:RadGrid>
        
           <br />
           <asp:Button runat="server" ID="btnFattura" Text="Fattura" 
               onclick="btnFattura_Click"/>
protected void rgrFatturazione_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e)
       {
           GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;
           if (e.DetailTableView.Name == "Commessa")
           {
               string Cliente2 = dataItem["Codice Cliente"].Text;
               e.DetailTableView.DataSource = this._LoadCommesse(int.Parse(Cliente2));
           }
           else
           {
               string Cliente3 = dataItem["Cliente Commessa"].Text;
               string Commessa = dataItem["Commessa"].Text;
               e.DetailTableView.DataSource = this._LoadRapportini(Commessa, int.Parse(Cliente3));
           }
       }
}
i try this but doesn't work..
protected void btnFattura_Click(object sender, EventArgs e)
        {
            foreach (GridDataItem clienti in rgrFatturazione.MasterTableView.Items)
            {
                foreach (GridDataItem commesse in clienti.ChildItem.NestedTableViews[0].Items)
                {
                    foreach (GridDataItem rapportini in commesse.ChildItem.NestedTableViews[0].Items)
                    {
                          
                    }
                }
            }
        }
thanks!!

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 17 Aug 2010, 04:11 PM
Hello Matteo,

More information about how you can loop through all detail tables/items in RadGrid is available in the help article below:
Traversing detail tables/items in Telerik RadGrid

Give it a try and let me know if it helps.

Regards,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Larry
Top achievements
Rank 2
answered on 25 Oct 2012, 03:55 PM
This link is broken.
0
Princy
Top achievements
Rank 2
answered on 26 Oct 2012, 04:21 AM
Hi,

Here is the link.
Traversing detail tables/items in Telerik RadGrid

Thanks,
Princy.
Tags
Grid
Asked by
Matteo Beretta
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Larry
Top achievements
Rank 2
Princy
Top achievements
Rank 2
Share this question
or