FindControl
Find a control in a TemplateField programmatically
Submitted by Ben Hodson on Wed, 03/19/2008 - 20:56
When you add a DetailsView or GridView control to your page, you may need to programmatically access that control in the code behind. You might look at the System.Web.UI.Page object and see it has a FindControl (http://msdn2.microsoft.com/en-us/library/31hxzsdw.aspx) method built in for you. If you thought that you could get ANY control on the page...
You would be wrong.
System.Web.UI.Page find a control by type
Submitted by Ben Hodson on Tue, 03/18/2008 - 19:54
There's not a lot of information on how to find a control by it's type. Of course, most of us know you can find a control by it's "ID" property with the Page object's public method "FindControl()". Here's an example of how to do that:
// find a control on the page by it's IDstring sIdToFind = "RequiredFieldValidator1";
// use the FindControl() and pass the ID to search forPopular Articles
Last viewed:
- Change Password Policy on Windows 2003 Server
- Data Access Layer using SqlDataReader and C#
- Silverlight Memory Leak DataGrid, DataForm, DataTemplate, etc...
- How to localize a BoundField / TemplateField HeaderText
- Disable Button on Submit (Prevent multiple submits)
- Clustered Index vs. Non-Clustered Index in SQL Server


Recent comments
1 day 54 min ago
1 day 6 hours ago
1 week 1 day ago
1 week 1 day ago
1 week 2 days ago
1 week 5 days ago
2 weeks 1 day ago
2 weeks 1 day ago
2 weeks 1 day ago
2 weeks 1 day ago