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

Recommended Answers

All 2 Replies

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

thank you so much, it worked.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.