save textbox values to database

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Apr 2007
Posts: 30
Reputation: DeOiD is an unknown quantity at this point 
Solved Threads: 0
DeOiD DeOiD is offline Offline
Light Poster

save textbox values to database

 
0
  #1
Apr 20th, 2007
hi.
i use a textbox (i also tried with a textarea) in asp .net2.0 to show some text from a data base. till this point, everything's ok. my problem starts when i try to change the text and update the new value to the data base. the value updated is always the old one...

i use this line to give the textbox the value of the data base

txt1.text = dbdatareader.item(0) (funny part is that if i delete this line it works perfectly, but i new to show the database value)

please help me
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 10
Reputation: Blackred is an unknown quantity at this point 
Solved Threads: 2
Blackred's Avatar
Blackred Blackred is offline Offline
Newbie Poster

Re: save textbox values to database

 
0
  #2
Apr 20th, 2007
Hello,

It sounds like you are populating the textbox on load but you are not wrapping a check to see if the page has posted back around the databind.

For example...

  1. Textbox1.Text = dbdatareader.item(0)

Becomes...

  1. If Not.PageIsPostback Then
  2. Textbox1.Text = dbdatareader.item(0)
  3. End If
Last edited by Blackred; Apr 20th, 2007 at 7:58 am.
This station is non-operational.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 30
Reputation: DeOiD is an unknown quantity at this point 
Solved Threads: 0
DeOiD DeOiD is offline Offline
Light Poster

Re: save textbox values to database

 
0
  #3
Apr 20th, 2007
thank you so much, it worked.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC