Hello Everybody!

I have a simple question: where can I get or set a control, which is in a template field?

I have a gridview, and I've created a templatefield in it, with a textbox inside. I want to use the data typed in that textbox, but I don't know how to reach it.

I've tried the following:

GridView1.SelectedRow.Cells[4]. how to continue? Looked for everywhere, but no sign of it.

(The textbox is int the fourth column).

Thank you!

8 Years
Discussion Span
Last Post by konczuras

Thank you for your reply, but I haven't found the stuff there I was looking for. However, I've figured it out, so I post it to the others:

Control tex1 = GridView1.Rows[RowID].Cells[8].Controls[1];
//Here's the controlsource
TextBox box;
box = (TextBox)(tex1.FindControl("Name of the control"));

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.