Welcome to WebmasterWorld Guest from 52.91.176.251

Forum Moderators: ocean10000

Message Too Old, No Replies

update problem in asp.net

     
9:46 am on Nov 24, 2008 (gmt 0)

New User

10+ Year Member

joined:Nov 24, 2008
posts:14
votes: 0


hi..
I am designing a website.In this,I needs to retrive values from database in a textbox(suppose I retrived value abc in textbox named textboxNewName) and after editing (changing the value to xyz) ,I need to update database with these new value on update button click.But when I am retriving the value in update button click using
dim newValue as string=textboxNewName.text 

then Instead of new value it is giving old value(abc).This thing i confirmed by debuging the code and also updatequery is running succussfully as it's return value is 1.

please suggest me what I am doing wrong. :tntworth:

11:41 am on Nov 24, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 24, 2005
posts:965
votes: 0


It would help if you posted your code.

In the first instace, are you populating the Textbox from the OnLoad event? If this is the case then you must realise that the onload event gets called before the onclick event. Like this...

1. Onload is called, and the texbox gets populated with "foo"

2. The user replaces the textbox with "bar" and presses the submit button causing a postback.

3 Onload is called, and the texbox gets populated with "foo"

4 Onclick is called and the database gets updated with the textbox contents ("foo")

You need to remove step 3, possibly by checking the Page.IsPostback method.

11:58 am on Nov 24, 2008 (gmt 0)

New User

10+ Year Member

joined:Nov 24, 2008
posts:14
votes: 0


ok..thanx buddy...first i will try for that and if problem doesnot solved ,then i will post code..
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members