UserControl that embeds another user control, how to access embedded form fields? -


i have long form user has fill out.

so broke form logical units , created user control elements (they reused elsewhere).

so form has these fields:

usercontrol3.ascx

username password email -- usercontrol2.ascx address -- usercontrol2.ascx city -- usercontrol2.ascx state -- usercontrol2.ascx

so in codebehidn of usercontrol3.ascx, how access usercontrol2.ascx's fields can write db?

something works, not elegant:

dim txtbox textbox = ctype(parentcontrol.controls(index), system.web.ui.controls.textbox) stringvariable = txtbox.text 

the correct way implement properties parentcontrol access child's controls properties.

public property addressfield() string   set(byval value string)     txtaddressfield.text = value   end set       return txtaddressfield.text   end end property 

Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -