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

Find how many child row

1 Answer 78 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Myriam
Top achievements
Rank 1
Myriam asked on 06 Feb 2009, 04:45 PM
Hello
I have a radgrid with mastertableView and detailtableView...
In the RadGrid_DataBound event I would like to know how much detailtable row does it have.
Here is a part of my code
Private Sub RadGrid_offre_DataBound(ByVal sender As ObjectByVal e As System.EventArgs) Handles RadGrid_offre.DataBound  
        Dim grid As RadGrid = TryCast(sender, RadGrid)  
        Dim gridItems As Integer = grid.MasterTableView.Items.Count  
        If gridItems < 6 Then 
            grid.Height = 250  
        Else 
            grid.Height = 250 + (gridItems * 30)  
        End If 
        If grid.Height.Value > 650 Then 
            grid.Height = 650  
        End If 
    End Sub 
I would like to know the items.count of the child of my mastertableview
something like
grid.mastertableview.detailtables.items.count..
Hope that makes sense
Thank you

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 09 Feb 2009, 11:57 AM
Hi Myriam,

Set the Name property for the Detail table and try accessing the count Detail table items in the ItemDataBound event as shown below.

ASPX:
 <DetailTables> 
                      <telerik:GridTableView runat="server" Caption="Detail"   Name="Detail"  DataSourceID="SqlDataSource1" > 
                     

CS:
  protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        if ((e.Item is GridDataItem) && (e.Item.Expanded)) 
        { 
            GridTableView tableView = (GridTableView)e.Item.OwnerTableView; 
            int childRowcount = tableView.Items.Count; 
        } 
   } 


Thanks
Shinu
Tags
Grid
Asked by
Myriam
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or