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

Accessing RadGrid from child page

1 Answer 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Clive Hoggar
Top achievements
Rank 1
Clive Hoggar asked on 03 Mar 2009, 09:53 PM
Hi

I am trying to run some code behind based on the SelectedItemChanged event of RagdGrid1.
I have this running OK in a standard aspx page but I am trying to use the same approach
with the Grid in a master page.   How do I reference the RadGrid from the child page?

I am trying this:

Imports 

 

Telerik.Web.UI

 

 

 

Partial Class latour

 

 

 

Inherits System.Web.UI.Page

 

 

 

 

Protected Sub RadGrid1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1_SelectedIndexChanged  
        Dim strUnitOfSale, strName, strVintage, strProductCode As String  
        Dim RadGrid1 As RadGrid  
        RadGrid1 = CType(Master.Master.FindControl("ContentPlaceHolder3col").FindControl("RadGrid1"), RadGrid)  
 
' code to do stuff here  
End Sub

End Class

This approach works for finding labels and text boxes for the onload event, but in this case, although the selected row changes color,
the code behind does not run. (and no produces no run time errors)

Can you help?

Thanks

Clive

1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 06 Mar 2009, 12:13 PM

Hi Clive,

Generally, you should be able to access the grid in the same way as with other controls which reside on the parent master page. Can you please debug your code to see whether the grid is referenced as expected? Note that if the grid resides inside another control, you will need to find the other control first with the FindControl(id) method and then call FindControl("RadGrid1") for it.

Best regards,

Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Clive Hoggar
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Share this question
or