954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

save textbox values to database

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

DeOiD
Light Poster
30 posts since Apr 2007
Reputation Points: 10
Solved Threads: 0
 

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...

Textbox1.Text = dbdatareader.item(0)


Becomes...

If Not.PageIsPostback Then
    Textbox1.Text = dbdatareader.item(0)
End If
Blackred
Newbie Poster
10 posts since Apr 2007
Reputation Points: 10
Solved Threads: 2
 

thank you so much, it worked.

DeOiD
Light Poster
30 posts since Apr 2007
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You