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
1
vote
1 answer
How does FindControl work in GridView?
I am trying to update a database using the GridView edit, update CommandField. I have two editable fields which are displayed as text boxes when in edit mode. When clicking submit, I am trying to put the text box values into variables to work with,…

Starwfanatic
- 584
- 2
- 13
- 29
1
vote
3 answers
Can't locate checkbox in webform
I'm trying to locate a checkbox on my webform, but am not able to? It's always set to NULL? I have tried different approaches (the i is set via a FOR loop, I'm using a Masterpage as well):
CheckBox cb =…

Robert Benedetto
- 1,590
- 2
- 29
- 52
1
vote
4 answers
Avoid double control search in LINQ query
I have a Dictionary where key - control's ID and value - it's visible status to set:
var dic = new Dictionary
{
{ "rowFoo", true},
{ "rowBar", false },
...
};
Some of controls can be null, i.e.…

abatishchev
- 98,240
- 88
- 296
- 433
1
vote
2 answers
Can't clear credentials textboxes on ASP.NET CreateUserWizard Control
I have a CreateUserWizard control using forms authentication on my login/create user page. I customized the CreateUserWizardStep1 so that I could add some additional validators.
After successfully creating a user with the control and it displays…

bulltorious
- 7,769
- 4
- 49
- 78
1
vote
1 answer
Reaching repeater item: The Logic
Here is my design page:
…

Serkan Cebeci
- 43
- 6
1
vote
1 answer
Where is my validator?
I have a validator in my page:
*
I found that in…

Cheng Chen
- 42,509
- 16
- 113
- 174
1
vote
2 answers
Finding page controls starting with some string
I have many of TextBoxes in the ASP.NET page that their ID starts with certain string like xyz(e.g: xyz1,xyz11,xyz999). I know FindControl method, but it finds only by complete ID of Control.
How can I find controls in which their ID be like that…

Majid
- 13,853
- 15
- 77
- 113
1
vote
0 answers
Find and update dynamically generated html element by ID
I have a comments thread/discussion board much like this one. The entire comments thread is generated via a function call which returns HTML to display on the page. At the bottom of each different comment I have buttons 'Useful - YES/NO' and 'Mark…

user2820706
- 11
- 1
1
vote
1 answer
ASP.NET WebForms and SimpleInjector FindControl throws no parameterless constructor
I have Web Application in Asp.NET (4.5) and Simple Injector. All application works right and Simple Injector too. But the problem is with FormView:
…

Robert
- 2,571
- 10
- 63
- 95
1
vote
3 answers
How can I retrieve the values of controls in the form that posted?
I know this has got to be the simplest-sounding question ever asked about ASP.Net but I'm baffled. I have a form wherein my visitor will enter name, address, etc. Then I am POSTing that form via the PostBackUrl property of my Submit button to…

Mike K
- 1,313
- 2
- 18
- 28
1
vote
4 answers
Understanding syntax in C#
I am hoping someone can help me understand what is going on in the code line below:
Table t = (Table)Page.FindControl("Panel1").FindControl("tbl");
I understand Page.FindControl("Panel1").FindControl("tbl");
Why is there a (Table) before the…

user279521
- 4,779
- 21
- 78
- 109
1
vote
1 answer
vb.net findcontrol by a part of id
I need to find a control in one page but I don't know the complete ID. I only know a part of the ID.
What I wan't to do is something like this:
control = Page.FindControl(part1 & part2)
Where part1 is the known part of the ID and part2 is the…

burk15
- 23
- 4
1
vote
0 answers
FindControl no longer working after .NET 4.5 Upgrade
Prior to upgrading to .NET 4.5 the code was working correctly with findControl, but it was because they were being added with the prepended placeholder location. We are now receiving
Object reference not set to the instance of an object.
on code…

Nick G
- 1,209
- 8
- 34
- 58
1
vote
2 answers
How can i find a specific element/field in the class
I have 2 page app. First page MainPage, and second page is class and name "Links". I have buttons in mainpage. and i have string variables in "Links" with the same name as the buttons.
For example
class Links
{
public static string a1 =…

Murat KA
- 137
- 1
- 7
1
vote
1 answer
Using C# FindControl to find a user-control in the master page
So all I want to do is simply find a user control I load based on a drop down selection. I have the user control added but now I'm trying to find the control so I can access a couple properties off of it and I can't find the control for the life of…

MisterIsaak
- 3,882
- 6
- 32
- 55