Questions tagged [findcontrol]

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.

374 questions
3
votes
3 answers

What can cause FindControl() to throw a NullReferenceException?

I have a user control I'm building (ASP.NET 3.5, using C#). This control is largely based on another, similar control (cut & paste inheritance, unfortunately, but there's no easy way to abstract this). The lines that are giving me trouble are…
Jeff
  • 2,835
  • 3
  • 41
  • 69
3
votes
2 answers

How to get all the controls inside a specific cell in a GridView

I am generating CheckBox controls dynamically inside a GridView. Now i need to validate if atleast one CheckBox is selected and also while saving data i need to iterate through all the controls inside the cell. Now the issue is i cannot do…
Ishan
  • 4,008
  • 32
  • 90
  • 153
3
votes
5 answers

Unable to find control in asp.net Repeater control

This has got me stumped. I am trying to find a checkbox in a dynamically loaded asp.net Repeater template. The template works fine and the databinding is fine and everything displays fine but I can't find the control! Any ideas? This is the repeater…
Dkong
  • 2,748
  • 10
  • 54
  • 73
3
votes
2 answers

getting the values from PreviousPage.FindControl

I'm trying to make a confirmation page for a reservation form. And I'm having trouble getting the value from my previous pages controls. I have everything running at server and I have my submit button's PostBackURL pointing to the confirmation page.…
Andrew-Saarima
  • 270
  • 3
  • 9
3
votes
3 answers

Find control in Web Forms inside a repeater

I'm unable to find a Literal inside a Repeater that is in another UserControl. I have the following UserControl:
3
votes
1 answer

FindControl Not working if its being called from a different Class

On page_Init, I am creating number of UpdatePanels and inside these UpdatePanels one Panel in each. I then use this panel to further go ahead and add other controls dynamically. For example I add number of TextBoxes and Buttons in each of these…
Manish Rajput
  • 43
  • 1
  • 4
3
votes
1 answer

Can't find controls in FormView.InsertItemTemplate even on DataBound event

I have FormView in my page markup:
abatishchev
  • 98,240
  • 88
  • 296
  • 433
3
votes
5 answers

FormView.FindControl() returns null until DataBind()

Why method FindControl() returns null on FormView until call DataBind(). After that it returns everything correctly? What workaround are there? Call DataBind() before first call of FindControl() ?
abatishchev
  • 98,240
  • 88
  • 296
  • 433
3
votes
3 answers

Access Control inside GridView Pager Template - ASP.NET

I am trying to access a LinkButton that is inside a PagerTemplate in a GridView. However, I am getting a NullReferenceException and I don't know what I am doing wrong here. I have tried the…
NullReference
  • 83
  • 1
  • 2
  • 4
3
votes
1 answer

FindControl looks for controls in incorrect template of FormView

How do you locate controls from the codebehind when switching modes in a FormView? It looks like you can't use FindControl during the Page_Load event, since it will be searching for controls in the previously shown template rather than the newly…
Drkawashima
  • 8,837
  • 5
  • 41
  • 52
3
votes
1 answer

populating a text box with FindControl

I have multiple textboxes and I want to programatically populate them with the same method.
Stuart
  • 1,544
  • 5
  • 29
  • 45
3
votes
2 answers

FormView.FindControl(): object reference error

I have a formview that has several textboxes inside of tr/td's. I'm trying to get the textboxes by using the .FindControl method but it's coming back null. The FormView is always in Edit mode (so I'm always in the EditItemTemplate) and i'm trying…
Tone
  • 2,793
  • 6
  • 29
  • 42
3
votes
2 answers

ASP.net .FindControl() and GridView returning null

I have looked over the pages on the site, but cant seem to find something general enough for my problem, so was hoping someone knows what to do. I am debugging some code someone else wrote and am having problems with a GridView statement. My…
user1816892
  • 85
  • 3
  • 8
3
votes
1 answer

How do I get the selected value of a dropdownlist usercontrol located inside of the insertitemtemplate of my formview?

I'm a .NET newbie, but here is my question: I have an application that makes use of Master Pages. I have a page that has a formview on it used to input address information. In the insertitemtemplate is a usercontrol that I am referencing. This…
2
votes
1 answer

how do i reference a listview control that is nested in the itemtemplate of another listview control?

I have a listview control that is nested in the item template of another listview control that i'm trying to reference in codebehind using the .FindControl() method, but it keeps returning null. After get this to work, I'll need to reference a…
Sinaesthetic
  • 11,426
  • 28
  • 107
  • 176
1 2
3
24 25