Gridview RowEditing event problem

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?
 
G

Guest

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

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,520
Members
44,996
Latest member
rainocode

Latest Threads

Top