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

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

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -