Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8364839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:31:28+00:00 2026-06-09T12:31:28+00:00

I have a problem with FindControl function. The problem is as follow: aspx: <asp:Content

  • 0

I have a problem with FindControl function. The problem is as follow:

aspx:

<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" runat="server">
  <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
  </ajaxToolkit:ToolkitScriptManager>

  <table class="inputTable">
            <tr><td>
                <asp:CheckBox ID="Extern" AutoPostBack="True" OnCheckedChanged="OnCheckedChangedMethod" runat="server" />
                </td><td>Externes Unternehmen</td></tr>
    <tr>         
        <td>
            <asp:TextBox ID="Firmierung" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                ControlToValidate="Firmierung" Display="Dynamic" 
                ErrorMessage="RequiredFieldValidator"
                Text="Bitte geben Sie die Firmierung ein."></asp:RequiredFieldValidator>                
        </td>
    </tr>
  </table>  

aspx.cs:

protected void OnCheckedChangedMethod(object sender, EventArgs e)
    {            
        if (Extern.Checked)
        {                
            Control ctr = FindControl("RequiredFieldValidator1");                
            if (ctr != null)
            {
                ctr.Visible = false;
            }
        }
        else
        {                
        }
    }

But FindControl didn’t work, it couldn’t find that control. Was I wrong at any point?
Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:31:29+00:00Added an answer on June 9, 2026 at 12:31 pm

    Based on your limited source, you should be able to simplify your code behind method to:

    protected void OnCheckedChangedMethod(object sender, EventArgs e)
    {            
        this.RequiredFieldValidator1.Visible = this.Extern.Checked;
    }
    

    There should be no need for the use of FindControl().

    When you type “this.”, if you don’t see RequiredFieldValidator1 appear in your intellisense, and assuming you are using ASP.NET 2.0 or greater, check your VS.NET warnings to see if your .aspx has a warning message with an associated “Generation of designer file failed”. If so, you must correct the warning.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple gridview <asp:GridView ID=GridView1 runat=server DataKeyNames=OriginatorID AutoGenerateColumns=False AllowPaging=True OnPageIndexChanging=GridView1_PageIndexChanging PageSize=5 OnPreRender=GridView1_PreRender>
I have the following structure <asp:UpdatePanel ID=MyUpdatePanel runat=server> <ContentTemplate> <asp:MultiView ID=MyViews runat=server> <asp:View ID=List
I have a problem regarding with FindControl.I'm using ASPxRoundPanel(with DXperience component) in a repeater.
I have a problem with handling the function to update my gridview. Until now
I have problem with http://abfoodpolicy.com/ . In IE 8 and 9 the right sidebar
I have problem with my query on C, I’m using the oci8 driver. This
I have problem with repopulating form_upload after validation. Other input fields or selectboxes are
I have problem with show or hide form in Window Form Application. I start
I have problem with UIWebView delay when the load image from url. In my
I have problem while loading data into html select when users press or click

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.