A
Arthur Dent
Okay, this should be really simple, and maybe im just missing something
totally obvious, but i cannot figure this out. I did this all the time in
ASP.NET 1.1 with no problems.
I have a GridView which has a column that is a template column, and has a
textbox in the itemtemplate. There is one button in the footer of the grid
for "save"; so the user can type in changes to a bunch of rows, and then
click save, and my code iterates essentially as so:
For Each gr As GridViewRow In grid.Rows: SaveRow(gr): Next
This way they can change a bunch of rows and then save instead of doing
change a row, save, change a row, save, change a row, save, change a row,
save.
So my code (pseudo-code) looks like this:
Sub btnSave_Click
For Each gr As GridViewRow in grid.Rows
Dim newValue as string =
CType(gr.FindControl("txtValue"),TextBox).Text
Dim SQL as string = "Some Sql using the new value"
ExecuteSQL
Next
End Sub
The problem is, when i get the Text property from the textbox, it gives me
the OLD value to which it was initially bound, instead of giving me the new
value which the user typed in. Why? How am i supposed to get the user's new
data?
Please HELP!!
Thanks in advance,
- Arthur Dent
totally obvious, but i cannot figure this out. I did this all the time in
ASP.NET 1.1 with no problems.
I have a GridView which has a column that is a template column, and has a
textbox in the itemtemplate. There is one button in the footer of the grid
for "save"; so the user can type in changes to a bunch of rows, and then
click save, and my code iterates essentially as so:
For Each gr As GridViewRow In grid.Rows: SaveRow(gr): Next
This way they can change a bunch of rows and then save instead of doing
change a row, save, change a row, save, change a row, save, change a row,
save.
So my code (pseudo-code) looks like this:
Sub btnSave_Click
For Each gr As GridViewRow in grid.Rows
Dim newValue as string =
CType(gr.FindControl("txtValue"),TextBox).Text
Dim SQL as string = "Some Sql using the new value"
ExecuteSQL
Next
End Sub
The problem is, when i get the Text property from the textbox, it gives me
the OLD value to which it was initially bound, instead of giving me the new
value which the user typed in. Why? How am i supposed to get the user's new
data?
Please HELP!!
Thanks in advance,
- Arthur Dent