1

I have a Promote.aspx page which has a few radcomboboxes; radTerm and radOldYear. Promote.aspx also has a radgrid which is updatable by a WebUserControl, promote.ascx. This Web user control has a few radcomboboxes, radName and radNewyr.

In the promote.ascx.cs, i want to be able to find the comoboxes which are on the promote.aspx. Tried using:

RadComboBox tl = (RadComboBox)this.Page.FindControl("radTerm");

in vain! Someone please help me find the controls on the main page. i am calling them thru the webusercontrol that i load in the radgrid.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
rhys
  • 13
  • 3

1 Answers1

3

First, you have to find the promote.ascx control on the page, so:

Control promote = (Control)this.Page.FindControl("WhateverYouCalledPromote");

Now that you have found the control, you can search for the control that you want:

RadComboBox tl = (RadComboBox)promote.FindControl("radTerm");
abatishchev
  • 98,240
  • 88
  • 296
  • 433
The_Butcher
  • 2,440
  • 2
  • 27
  • 38
  • The control tree on a page, is, well, a tree, all the controls are not linear, but are contained in controls that can be contained in other controls, etc.. – SWeko Jan 21 '11 at 08:14
  • RadComboBox tl = (RadComboBox)this.Page.Master.FindControl("WhateverYouCalledPromote").FindControl("radTerm"); – rhys Jan 21 '11 at 08:25
  • Thanks abatishcev, your have helped me comeup with that! it worked! – rhys Jan 21 '11 at 08:26