A method on the Control class in the .NET framework that finds a control from its id. The control is only found if it is within the calling control's naming container.
Questions tagged [findcontrol]
374 questions
2
votes
4 answers
asp.net/VB.net: FindControl, instead of by ID by ControlType
i need to find a control in a repeater in my asp.net application.
At the moment I'm using FindControl("IdOfControl") and this is working well.
But I need to find a control by its type (ImageButton).
My current code:
For Each rptItem As RepeaterItem…

Keith L.
- 2,084
- 11
- 41
- 64
2
votes
2 answers
Finding user control in TemplateField of DetailsView
I have a DetailsView that I'm posting back - and inside of that is a UserControl. I'm having some difficulty located it in the postback data.
As an example:
…

Khanzor
- 4,830
- 3
- 25
- 41
2
votes
1 answer
Using FindControl to target a Literal
I have a ListView called "orderReceiptTable" which I am able to properly access from the Code Behind. Within it is a literal called "orgName" which I obviously would like to populate with an organization's name.
After much searching it was…

BehemothDan
- 316
- 3
- 15
2
votes
3 answers
Access Masterpage control on a basepage using FindControl
I have an ASP.NET website application on .NET 4.0. There is one Masterpage that contains the header and footer for all the aspx pages. The content comes from the individual aspx pages. I have BasePage.cs which all the aspx pages inherit from.
Now to…

itsbalur
- 992
- 3
- 17
- 39
2
votes
1 answer
Find Control using javascript inside an ASP:Login control
I have an ASP Login control box on the page which is customized.
Inside the Login control we have Username and password textboxes.
I want to find username and password controls with a javascript function.
var Username=…

Murtaza
- 3,045
- 2
- 25
- 39
2
votes
3 answers
gridview checkbox problem asp.net
I am trying to implement a checkbox within gridview,
The job of this checkbox is to verify a record,
When this verify button is pressed, all items with a checked checkbox are inputted into the database
This is my code:
protected void…

Karl
- 781
- 2
- 9
- 26
2
votes
2 answers
gridview findcontrol returning empty ""
i am trying to read from a textbox within a gridview by using this code
protected void Button1_Click(object sender, EventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
string textBoxText =…

Karl
- 781
- 2
- 9
- 26
2
votes
1 answer
Access controls on gridview while using paging
I am attempting to get information at postback from a checkbox on a gridview that has multiple pages. Things work fine when there is only one page worth of data, but with paging checkboxes always return false no matter what page you are on if you…

netwisedev
- 41
- 7
2
votes
1 answer
FindControl to find a control in the page
I have a list of months on my aspx page as follows:
2
votes
3 answers
Using FindControl to get GridView in a Content Page
I would like to find a GridView Control within a separate class and I am having issues doing so. I even tried placing my code in the aspx.cs page to no avail. I keep getting Object reference not set to an instance of an object. I'm sure there is a…

gcoleman0828
- 1,541
- 3
- 30
- 49
2
votes
1 answer
In WPF, how do I find an element in a template that's switched in via a trigger?
I have a UserControl (not a lookless custom control) which, depending on some custom state properties, swaps in various ContentTemplates, all defined as resources in the associated XAML file. In the code-behind, I need to find one of the elements…

Mark A. Donohoe
- 28,442
- 25
- 137
- 286
2
votes
3 answers
Which is faster in ASP.Net?
Our project is currently using 2 ways to find a Control inside of pages.
The first is to use .FindControl recursively.
The other is to use LINQ like this:
(from n in Page.Controls.Cast().Descendants(c => c.Controls.Cast())
where…

James P. Wright
- 8,991
- 23
- 79
- 142
2
votes
1 answer
Panel.FindControl() method isn't finding a control that has been added to it
Consider the following code, adding 2 textboxes with the same ID (oops):
protected void Page_Load(object sender, EventArgs e)
{
string TextBoxName = "TextBox1";
Panel p = new Panel();
TextBox t = new TextBox();
t.ID = TextBoxName;
…

Dominic Zukiewicz
- 8,258
- 8
- 43
- 61
2
votes
3 answers
Find Control on RowDataBound-Event returns as NULL/Empty
I am trying to get text value of the selected row from my GridView using FindControl, but the FindControl always returns as NULL.
.ASPX Code:

rakesh
- 326
- 7
- 19