asp.net - Textbox.text does not show updated text in code -


when use code below reason when update clicked, hospitaltextbox.text not show current value in textbox? value selected. idea why not reading in textbox?

dim reader sqldatareader = cmd.executereader()         if (reader.read())              hospitaltextbox.text = reader(7)             firstnametextbox.text = reader(9)             session("id") = reader(0)         end if  protected sub cmdupdate_click(sender object, e eventargs) handles cmdupdate.click     dim test string     test = firstnametextbox.text     try         dim con sqlconnection         dim cmd sqlcommand         con = new sqlconnection         con.connectionstring = ""         con.open()         cmd = new sqlcommand         cmd.connection = con         cmd.commandtext = "update tbltest set [teaching hospital name] = @teachinghospitalname, [physician first name] = @firstname id = @id"         cmd.parameters.add(new sqlparameter("@id", (session("id"))))         cmd.parameters.add(new sqlparameter("@teachinghospitalname", hospitaltextbox.text)) 'does not show text changed in textbox?         cmd.parameters.add(new sqlparameter("@firstname", test))         cmd.executenonquery()         con.close()       catch ex exception      end try end sub 

check page_load function.

are doing on postback set textbox value else?

if you're binding data, make sure it's done when not ispostback

if not ispostback    binddata() 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -