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
1
vote
4 answers

Why can't FindControl find a password field on my form?

If this is not possible, how can I get the password out of the field? dim pw1 as textbox, password as string pw1 = ctype(FindControl("PasswordStr"), textbox) password = pw1.text Nope: System.NullReferenceException: Object reference not…
rg89
  • 341
  • 1
  • 2
  • 18
1
vote
0 answers

How to Improve Method of Data Retrieval

I have many fields I'm trying to retrieve the data from to pass to the MySQL database. This is the method I am using right now: ... PlaceHolder MAIN = Page.FindControl("MAIN_PH") as PlaceHolder; HtmlTable tblMain =…
wolfsshield
  • 757
  • 5
  • 14
1
vote
3 answers

ASP.NET, controls added using .Controls.Add() are lost when page is posted back & if I add them using .InnerHtml I can't reference them

I'm trying to make a comments page. I get previously made comments from a database, and there's a textbox for the new comment to be submitted. So in order to display the old comments from the database they have to be added dynamically, right? At…
Nancy
  • 335
  • 1
  • 2
  • 9
1
vote
1 answer

Gridview FindControl finds Calendar, but not DropDownList

I have a DropDownList in a GridView EditItemTemplate. The ddl is to be populated at runtime; options in each row may vary. The GridView is working as desired. In non-edit mode, it binds to data. In edit mode the controls specified in the…
Mark Maslar
  • 1,121
  • 4
  • 16
  • 28
1
vote
1 answer

Finding control on aspx

I have a Promote.aspx page which has a few radcomboboxes; radTerm and radOldYear. Promote.aspx also has a radgrid which is updatable by a WebUserControl, promote.ascx. This Web user control has a few radcomboboxes, radName and radNewyr. In the…
rhys
  • 13
  • 3
1
vote
2 answers

FindControl in Asp.Net

I'm trying to find a control in a page. The Id is available as a server control (CheckBox) This throws exception "not able to convert string to double" Dim taskId As HtmlInputCheckBox i =10 taskId = Me.FindControl("chkTaskOption_" +…
selvaraj
  • 889
  • 2
  • 16
  • 29
1
vote
3 answers

C# unable to find content of ASP.net Textboxes

Okay so I am trying to create a sort of registration wizard, so there are different sections within the asp such as the one below:

user4184963
  • 79
  • 1
  • 10
1
vote
1 answer

How to get HtmlGenericControl by string in C#

I want to add a css class to a li tag in code behind given the id of the li tag.
  • Here is my c# code: System.Web.UI.HtmlControls.HtmlGenericControl ctrl = Page.FindControl("liOne") as…
    Natsuki_Kato
    • 157
    • 1
    • 13
    1
    vote
    2 answers

    FindControl not working on GridView when inserting bound columns

    I have a gridview with several ItemTemplates. The first contains a checkbox the rest contain textboxes. I then added dynamically some bound controls like this: BoundField bdfPrivName = new BoundField(); clsUtilities.SetBoundFieldCenter(ref…
    Bob Avallone
    • 979
    • 7
    • 20
    • 36
    1
    vote
    2 answers

    Unable to Find the Control from codebehind, but able to find other controls

    I am able to find the controls of all of these Lables and TextBoxes accept the edateTB. This is strange to me because it is in the same view as the sdateTB. So why would edateTB return NULL when I try to use FindControl on it and sdateTB return…
    Isawpalmetto
    • 785
    • 3
    • 12
    • 18
    1
    vote
    1 answer

    Call TemplateField DropDownList in asp.net - code behind with FindControl()

    This is how i created my DropDownListLehrbeginn in my GridView. sss
    1
    vote
    1 answer

    How to get the checked radio button value outputted to a label

    I am getting the output of 0 and I don't know what I am doing wrong. I using the findcontrol method to find the IDs within the Gridview and declaring them as radiobuttons, then I am trying to use an if statement to assign the checked radio button a…
    SRock2016
    • 123
    • 1
    • 2
    • 5
    1
    vote
    0 answers

    Reference Master control from client page

    I'm trying to reference a Literal control inside a ContentPlaceHolder on my Master page from a client page using the following code: Private Sub TestMsgBox() Dim mpContentPlaceHolder As ContentPlaceHolder Dim mpLiteral As Literal …
    gcresse
    • 115
    • 1
    • 12
    1
    vote
    1 answer

    Repeater control. Using a table that spans rows

    The following "FindControl" method fails to find the imgAd control. Any idea why? Could it be the Table that contains it? The intent of the table is to line things up in columns across rows.
    Chad
    • 23,658
    • 51
    • 191
    • 321
    1
    vote
    1 answer

    masterpage with findcontrol return null

    I have a master page with a label... When i try to find this label on backend it returns me null... Anyone can help me?
    Felipe A.
    • 929
    • 3
    • 12
    • 28