asp.net - Access control from .aspx in .ascx -


i have custom user control made called orderform.ascx. have .aspx file utilizes orderform control.

i want access control on .aspx file orderform control. there way this?

you use findcontrol method in user control this:

label label = page.findcontrol("label1") label; if (label != null)     string labeltext = label.text; 

as note on above, depending on label in page, may need use recursion find label.

you create property on page returns text of label:

public string labeltext {     { return label1.text; } } 

to access property user control, here 2 options:

option #1

string labeltext = ((pagename)page).labeltext; 

option #2

string labeltext = page.gettype().getproperty("labeltext").getvalue(page, null).tostring(); 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -