How to locate templatefield's contorls in C#?

Thread Solved

Join Date: Oct 2008
Posts: 58
Reputation: konczuras is an unknown quantity at this point 
Solved Threads: 1
konczuras konczuras is offline Offline
Junior Poster in Training

How to locate templatefield's contorls in C#?

 
0
  #1
Nov 20th, 2008
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!
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 144
Reputation: sierrainfo is an unknown quantity at this point 
Solved Threads: 9
sierrainfo sierrainfo is offline Offline
Junior Poster

Re: How to locate templatefield's contorls in C#?

 
0
  #2
Nov 21st, 2008
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 58
Reputation: konczuras is an unknown quantity at this point 
Solved Threads: 1
konczuras konczuras is offline Offline
Junior Poster in Training

Re: How to locate templatefield's contorls in C#?

 
0
  #3
Nov 25th, 2008
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"));
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 680 | Replies: 2
Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC