Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Unable to access controls on the page‏

Unable to access controls on the page‏

Scheduled Pinned Locked Moved ASP.NET
helpcsharphtmlsysadmindebugging
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Abbas82
    wrote on last edited by
    #1

    I am trying to set image visibility based on some user information. Howver I always receive the following error message Compiler Error Message: CS1061: 'XXX.SearchAcme' does not contain a definition for 'acmeBlemont' and no extension method 'acmeBlemont' accepting a first argument of type 'XXX.SearchAcme' could be found (are you missing a using directive or an assembly reference?) This is my markup and code behind so far...any ideas what the problem could be? I can't seem to figure out what the problem is. Using FindControl did not work either and while debugging the page only seems to have 1 control in the ControlCollection. However, when you hover over "this" on a breakpoint, you can drill down and see the images.

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Search.aspx.cs" src="Search.aspx.cs" Inherits="XXX.SearchAcme"
    MasterPageFile="~/Center/Lobby.Master" %>

    <asp:Content ID="Content1" ContentPlaceHolderID="SponsorContent" runat="server">
    <img id="acmeBlemont" runat="server" src="/acme/common/custom_images/weblet4_belmont.gif" width="170" height="45" border="0" visible="false" />
    <asp:Image id="acmeVerde" name="acmeVerde" runat="server" ImageUrl="/acme/common/custom_images/weblet4_verde.gif" width="170" height="45" border="0" visible="false" />
    </asp:Content>

    namespace XXX
    {
    public partial class SearchAcme : AdvisorPage
    {
    public SearchAcme()
    : base(ProgressNavIds.ChooseSearchOption)
    {

        }
    
         protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            this.acmeBlemont.Visible = true;
        }
    }
    

    }

    D 1 Reply Last reply
    0
    • A Abbas82

      I am trying to set image visibility based on some user information. Howver I always receive the following error message Compiler Error Message: CS1061: 'XXX.SearchAcme' does not contain a definition for 'acmeBlemont' and no extension method 'acmeBlemont' accepting a first argument of type 'XXX.SearchAcme' could be found (are you missing a using directive or an assembly reference?) This is my markup and code behind so far...any ideas what the problem could be? I can't seem to figure out what the problem is. Using FindControl did not work either and while debugging the page only seems to have 1 control in the ControlCollection. However, when you hover over "this" on a breakpoint, you can drill down and see the images.

      <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Search.aspx.cs" src="Search.aspx.cs" Inherits="XXX.SearchAcme"
      MasterPageFile="~/Center/Lobby.Master" %>

      <asp:Content ID="Content1" ContentPlaceHolderID="SponsorContent" runat="server">
      <img id="acmeBlemont" runat="server" src="/acme/common/custom_images/weblet4_belmont.gif" width="170" height="45" border="0" visible="false" />
      <asp:Image id="acmeVerde" name="acmeVerde" runat="server" ImageUrl="/acme/common/custom_images/weblet4_verde.gif" width="170" height="45" border="0" visible="false" />
      </asp:Content>

      namespace XXX
      {
      public partial class SearchAcme : AdvisorPage
      {
      public SearchAcme()
      : base(ProgressNavIds.ChooseSearchOption)
      {

          }
      
           protected override void OnPreRender(EventArgs e)
          {
              base.OnPreRender(e);
              this.acmeBlemont.Visible = true;
          }
      }
      

      }

      D Offline
      D Offline
      DoctorMick
      wrote on last edited by
      #2

      I've tried this and managed to reproduce your error. Suprisingly, removing the following attribute from your page declaration seems to resolve it.

      src="Search.aspx.cs"

      A 1 Reply Last reply
      0
      • D DoctorMick

        I've tried this and managed to reproduce your error. Suprisingly, removing the following attribute from your page declaration seems to resolve it.

        src="Search.aspx.cs"

        A Offline
        A Offline
        Abbas82
        wrote on last edited by
        #3

        God I hate that attribute! Good to know, but I don't think I can remove it :( so I have to rely on a recursive find control method, which may be a little less efficient but does the job.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups