Groups | Blog | Home
all groups > asp.net datagrid control > april 2005 >

asp.net datagrid control : TextBox Value



Simon Abolnar
4/24/2005 12:00:00 AM
I have TextBox column in datagrid.
I would like to update database with values when user click on button
(outside datagrid).

Dim cell As TableCell=datagrid.Items(row).Cells(col)
textbox=CType(cell.FindControl("TextBox1"), TextBox)

If user change text of TextBox in one column, command:
textbox.Text

display old value (not entered).
How can I find out changed text.

Thanks for help!

Simon

Elton W
4/24/2005 3:32:05 PM
Hi Simon,

If you rebind the datagrid's data source, the user entered
value is overwrited by data source (old) value. In order
to get user entered value, don't run command

datagrid.DataSource = dataobject

before button_click event.

HTH

Elton Wang
elton_wang@hotmail.com


[quoted text, click to view]
Simon Abolnar
4/25/2005 12:00:00 AM
Thank you for help!
I don't understand the answer. I don't do nothing to grid before
button_click event.

Simon

[quoted text, click to view]

Elton W
4/26/2005 10:44:50 AM
Do you only bind datagrid's data source when it's not
postback? If not, when you click button, it re-binds the
datagrid's data source first, then goes to button_click
event.

HTH

Elton


[quoted text, click to view]
AddThis Social Bookmark Button