Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem doing find control

Status
Not open for further replies.

onedizzydevil

Programmer
Mar 24, 2001
103
US
I have successfully used the Me.Page.FindControl("") to various controls mostly UserControls; however, I have made a Template page environment using information from various locations. Any way, no matter what I do it creates a _ctl# (# = 0-9, usually _ctl0) which is not a big deal it have more advantages than problems.

Page trace gives this

PAGE ASP.results_aspx 227636 1388
Form1 System.Web.UI.HtmlControls.HtmlForm 225405 0
_ctl0 ASP.template_ascx 166286 0
_ctl0:Uc_MainNav_Horizontal1 ASP.uc_MainNav_Horizontal_ascx 29752 0
_ctl0:Uc_MainNav_Horizontal1:ASPnetMenu1 CYBERAKT.WebControls.Navigation.ASPnetMenu 29750 3356
_ctl0:Uc_MainNav_Horizontal1:_ctl0 System.Web.UI.LiteralControl 2 0
_ctl0:Uc_MLSQuickSearch1 ASP.uc_MLSQuickSearch_ascx 1168 0
_ctl0:Uc_MLSQuickSearch1:_ctl0 System.Web.UI.ResourceBasedLiteralControl 393 0
_ctl0:Uc_MLSQuickSearch1:ddlSearchType System.Web.UI.WebControls.DropDownList 276 0
_ctl0:Uc_MLSQuickSearch1:_ctl1 System.Web.UI.LiteralControl 126 0
_ctl0:Uc_MLSQuickSearch1:txtSearchString System.Web.UI.WebControls.TextBox 148 0
_ctl0:Uc_MLSQuickSearch1:_ctl2 System.Web.UI.LiteralControl 28 0
_ctl0:Uc_MLSQuickSearch1:btnQuickSearch System.Web.UI.WebControls.Button 170 0
_ctl0:Uc_MLSQuickSearch1:_ctl3 System.Web.UI.LiteralControl 25 0
_ctl0:Uc_MLSQuickSearch1:DefaultButtons2 MetaBuilders.WebControls.DefaultButtons 0 0
_ctl0:Uc_MLSQuickSearch1:_ctl4 System.Web.UI.LiteralControl 2 0
_ctl0:pchContent System.Web.UI.WebControls.PlaceHolder 123780 0
_ctl0:_ctl0 System.Web.UI.LiteralControl 37 0
_ctl0:lblResultReturned System.Web.UI.WebControls.Label 80 32
_ctl0:_ctl1 System.Web.UI.LiteralControl 89 0
_ctl0:hlnkSaveSearchCriteria System.Web.UI.WebControls.HyperLink 141 0
_ctl0:_ctl2 System.Web.UI.LiteralControl 37 0
_ctl0:hlnkNewSearch System.Web.UI.WebControls.HyperLink 116 0
_ctl0:_ctl3 System.Web.UI.LiteralControl 31 0
_ctl0:Uc_searchresults1 ASP.uc_searchresults_ascx 123222 0
_ctl0:Uc_searchresults1:cpnlAdvancedSearchOptions eWorld.UI.CollapsablePanel 54752 252
_ctl0:Uc_searchresults1:uwtAdvancedOptions Infragistics.WebUI.UltraWebTab.UltraWebTab 51506 328
_ctl0:Uc_searchresults1:uwtAdvancedOptions:_ctl0 Infragistics.WebUI.UltraWebTab.ContentPane 792 0
_ctl0:Uc_searchresults1:uwtAdvancedOptions:_ctl0:_ctl0 System.Web.UI.LiteralControl 7 0
_ctl0:Uc_searchresults1:uwtAdvancedOptions:_ctl0:Uc_searchresultsadvancedoptions1





I can not figure out how to get past the _ctl0, to get to Page > _ctl0 > uc_searchresults > GoToZipCode (function)


I have done previously but the with the templates it _ctl0 or maybe something is stopping the current code from working.

Any idea how to work around this?

-Wayne



Wayne Sellars

"Programming, today is a race between software developers, striving to build bigger and better idiot-proof programs, and the Universe, trying to produce bigger and better idiots. So far, Universe 1 - Programmers 0."
 
Normally, you wouldn't reference it that way. Instead, you would declare the UC as a class field, just like any other object:

protected Label lblMyLabel; //this is just a label
protected MyProject.MyUC myUC; //this is your UC

~~~~~

myUC.GoToZipCode();

The INamingContainer stuff (which is what puts all the ctrl_... on your objects) is a huge pain if you try and reference objects directly, which is why you have to declare them as class fields, and access them that way.

-paul

penny.gif
penny.gif

The answer to getting answered -- faq855-2992
 
That works if your in or above where you are hunting...
In this case I have:

Page contains uc_searchresults
uc_searchresults contains uc_advancedoptions
uc_advancedoptions contain (in a tab control)uc_advancedfilters, uc_advancedzipcodesearch, uc_advancedsortoptions, uc_advancedschoolfilters

I need to go from uc_advancedzipcodesearch up to uc_searchresults then run GoToZipCode,



Wayne Sellars

"Programming, today is a race between software developers, striving to build bigger and better idiot-proof programs, and the Universe, trying to produce bigger and better idiots. So far, Universe 1 - Programmers 0."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top