Gridview RowEditing event problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a gridview template field that I would like to get the value of during
the RowEditing event, but can't figure out how.
Here's an example of how I get the value of a cell for the row being edited:
Dim WasherNum As String = gvBrazeLoad.Rows(e.NewEditIndex).Cells(6).Text

It works if the Cell is databount, but it doesn't work for a template field.
How do I do it?
 
TemplateFields contain controls that have value, they do not in themselves
have values, in the way that BoundFields do. You need to reference the
control. E.g. if the control was a textbox you could use the following in
C#:

TextBox MyTextBox =
(TextBox)gvBrazeLoad.Rows(e.NewEditIndex).Cells(6).FindControl("TextBoxID");

MyTextBox.Text would then contain the value you want.
 
That did the trick.
Thanks

clickon said:
TemplateFields contain controls that have value, they do not in themselves
have values, in the way that BoundFields do. You need to reference the
control. E.g. if the control was a textbox you could use the following in
C#:

TextBox MyTextBox =
(TextBox)gvBrazeLoad.Rows(e.NewEditIndex).Cells(6).FindControl("TextBoxID");

MyTextBox.Text would then contain the value you want.
 
Back
Top