Web Controls Not Talking to Each other in ASP.NET using VB.NET -


i have asp.net page loads 2 controls, control , control b. control has generic form submit , clear buttons trigger click events in its' own code behind use reflection call update function in control b has few input fields. have debugged , seems in order, however; when update function in control b called input fields not returning value when using inputname.text or me.inputname.text. have ideas why not working? guidance appreciated.

this code in control a's codebehind calls update method in control b's code behind

    protected sub btnsave_click(byval sender object, byval e eventargs) handles btnsave.click     try         dim lctlcontrol = session("selectedqstnctl")         dim methodobj = lctlcontrol.gettype().getmethod("updategeninfo", bindingflags.nonpublic or bindingflags.instance)         ' execute updategeninfo method update data          methodobj.invoke(lctlcontrol, nothing)     catch ex exception         'todo: check concurrency error here     end try end sub 

this update function in control b being called. session values being passed, form fields not.

protected sub updategeninfo()     dim lclutil new clutility     dim geninfo new clgeninfo     try         dim dt integer         'update data 1-2         dt = geninfo.updategeninfo_e1_01_02(session("connstrep"), me.varlastupdate, session("appno"), session("revno"), _                                           me.txtprname.text, me.txtpraddr1.text, me.txtpraddr2.text, _                                           me.txtprcity.text, me.txtprstate.text, me.txtprzip.text)     catch ex exception         'display error         lclutil.displaymsg(me.lblerrmsg, string.format("error location: sub loadgeninfo (ctle1_01_02) {0}", ex.message))     end try end sub 

the cause control instance stored in session not control instance on current page. example, if you're storing control instance in session when page first loaded, , retrieving on post-back, different instance.

if can't give control a direct reference control b, change code store reference in page.items collection:

protected sub page_load(byval sender object, byval e eventargs)     page.items("selectedqstnctl") = theselectedqstnctl end sub  protected sub btnsave_click(byval sender object, byval e eventargs) handles btnsave.click     dim lctlcontrol = directcast(page.items("selectedqstnctl"), yourcontrolclass)     lctlcontrol.updategeninfo() end sub 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -