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

FindControl of GridFooterItem within ItemDataBound event handler within GridDataItem context

5 Answers 134 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Phil
Top achievements
Rank 2
Phil asked on 20 Feb 2009, 01:42 PM
I have a master detail grid.  I am trying to modify the footer in the detail grid view, but the FindControl is returning nothing.
Protected Sub invoiceHeaderGrid_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs) 
    If TypeOf e.Item Is GridDataItem Then 
        Dim _item As GridDataItem = e.Item 
        If (_item.OwnerTableView.Name = "InvoiceDetails") Then 
            Dim _ftrItem As GridFooterItem = _ 
                DirectCast(_item.OwnerTableView.GetItems(GridItemType.Footer)(0), GridFooterItem) 
       End If 
   End If 
End Sub 
 

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 20 Feb 2009, 02:17 PM
Hello Phil,

You can try out the following code to access the FooterItem for the DetailTable of your grid:
cs:
     Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs) 
         If TypeOf e.Item Is GridFooterItem AndAlso e.Item.OwnerTableView.Name = "Detail1" Then 
             Dim _ftrItem As GridFooterItem = DirectCast(e.Item, GridFooterItem) 
         End If 
     End Sub 

Thanks
Princy.
0
Phil
Top achievements
Rank 2
answered on 20 Feb 2009, 02:34 PM
I am currently doing what you suggest, but the GridDataItem context has the data that I need to place in the footer.  Some of the times that row in the GridDataItem does not exist. 
Is it that the footer does not exist yet?
0
Princy
Top achievements
Rank 2
answered on 23 Feb 2009, 05:28 AM
Hello Phil,

If you are trying to access the footer item of your detail table and alter its data based on the data item of the detail table of the grid itself, then you can try out the following code:
cs:
     Protected Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As EventArgs)     
         
         For Each _item As GridDataItem In RadGrid1.Items 
             If _item.OwnerTableView.Name = "InvoiceDetails" Then 
                 Dim _ftrItem As GridFooterItem = DirectCast(_item1.OwnerTableView.GetItems(GridItemType.Footer)(0), GridFooterItem) 
             End If 
         Next 
     End Sub 

-Princy.
0
Phil
Top achievements
Rank 2
answered on 24 Feb 2009, 02:00 AM
I was wondering how I can teach myself these things?
0
Princy
Top achievements
Rank 2
answered on 24 Feb 2009, 04:52 AM
Hello Phil,

Telerik has put together documents related to nearly every functionality. Put in some time to implement these and have a look at different scenarios, thats how i got the basics in place. Refer to the following document to understand how to access rows and cells in a grid:
Accessing cells and rows
 
Thanks
Princy.
Tags
Grid
Asked by
Phil
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Phil
Top achievements
Rank 2
Share this question
or