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 557557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:02:19+00:00 2026-05-13T12:02:19+00:00

I have a simple .ascx file <%@ Control Language=C# AutoEventWireup=true CodeFile=Profile.ascx.cs Inherits=UserControls_Profile %> <%@

  • 0

I have a simple .ascx file

<%@ Control Language="C#"
    AutoEventWireup="true"
    CodeFile="Profile.ascx.cs"
    Inherits="UserControls_Profile" %>
<%@ Register Assembly="RadChart.Net2"
    Namespace="Telerik.WebControls"
    TagPrefix="radC" %>
<div id="testdiv" runat="server"></div>

in code behind:

protected void Page_Load(object sender, EventArgs e) {
  Chart();
}

private void Chart() {
  testdiv.Visible=false;
}

When I try to access the page I get the exception:

error CS0103: The name ‘testdiv’ does not exist in the current context

I have tried onload as well but same result!

  • 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-05-13T12:02:19+00:00Added an answer on May 13, 2026 at 12:02 pm

    If you have an HTML div, you need to add a runat attribute like

      <div id="testDiv" runat="server">Hello world</div>
    

    HTML elements like div’s are not ASP.NET Controls though and mixing HTML “controls” with ASP.NET might be problematic. You may prefer to do something like

      <asp:panel id="myPanel" runat="server">Hello world</asp:panel>
    

    Update: Also check Profile.ascx.designer.cs which should be auto-generated by Visual Studio to contain “protected HtmlControl testdiv”. I assume that is missing from the partial class. I note you derive from UserControls_Profile which may be cause for confusion.

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

Sidebar

Related Questions

I have a simple asp.net user control: <%@ Control Language=C# AutoEventWireup=true CodeBehind=QueryDefinitionItem.ascx.cs Inherits=xxx.UserControls.QueryDefinitionItem %>
I have a simple user control with this code: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="Pager.ascx.cs"
Ok I created simple user control that look like this <%@ Control Language=C# AutoEventWireup=true
I have the following definition at the top of my .ASCX file: <%@ Control
I have simple SSIS package which reads data from flat file and insert into
I have simple SSIS package where I import data from flat file into SQL
I have a simple ASP.NET Web User Control. It looks like this: <%@ Control
I have simple web user control (the code I found somewhere in the web):
I have a simple html table tag with 2x2 cells on my ascx. There
I have a simple user control that contains some buttons that fire events which

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.