not declared error- control inside a control inside a webform

Discussion in 'ASP .Net' started by DC Gringo, Sep 14, 2004.

  1. DC Gringo

    DC Gringo Guest

    I've got a web user control (a) inside a web user control (b) inside a
    webform (c). I need the webform to set a label control text value inside
    the inner of the two web user control.

    Inside my web form's code behind I have:

    mainHeader1.sectionHeader1.theSectionHeader.text = "Eritrea"
    I'm getting "mainHeader1 is not declared" error.

    What am I doing wrong?


    --
    _____
    DC G
     
    DC Gringo, Sep 14, 2004
    #1
    1. Advertising

  2. DC Gringo

    Karl Guest

    you aren't declaring mainHeader1 *g*

    I take it on your page you have

    it's hard to know what's wrong without seeing the html...

    but looking at it, I'd expect to see:

    In the page:
    <sometag:somecontrol1 id="mainHeader1" runat="server" />

    in somecontrol1:
    <sometag:somecontrol2 id="sectionHeader1" runat="Server" />

    in somecontrol2:
    <asp:label id="theSectionHeader" runat="erver" />


    Then in page codebehind
    protected mainHedaer1 as somecontrol

    sub page_load
    mainHeader1.sectionHeader1.theSectionHeader.text = "Eritrea"
    end sub


    in somecontrol1 codebehind:
    public sectionHeader1 as somecontrol2


    in somecontrol2
    public theSectionHeader as label


    Karl
    --
    MY ASP.Net tutorials
    http://www.openmymind.net/


    "DC Gringo" <> wrote in message
    news:...
    > I've got a web user control (a) inside a web user control (b) inside a
    > webform (c). I need the webform to set a label control text value inside
    > the inner of the two web user control.
    >
    > Inside my web form's code behind I have:
    >
    > mainHeader1.sectionHeader1.theSectionHeader.text = "Eritrea"
    > I'm getting "mainHeader1 is not declared" error.
    >
    > What am I doing wrong?
    >
    >
    > --
    > _____
    > DC G
    >
    >
     
    Karl, Sep 14, 2004
    #2
    1. Advertising

  3. DC Gringo

    DC Gringo Guest

    Karl,

    Thank you for your attention. I think I'm almost there. I did what you
    said and still come up with:

    The base class includes the field 'SectionHeader1', but its type
    (fn3p2.mainHeader) is not compatible with the type of control
    (ASP.sectionHeader_ascx).

    Line 33: <UC1:SECTIONHEADER ID="SectionHeader1"
    RUNAT="server"></UC1:SECTIONHEADER>

    Source File: D:\webs\projects\fewsnet\fn3.0\r3\mainHeader.ascx

    _____
    DC G




    "Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
    message news:...
    > you aren't declaring mainHeader1 *g*
    >
    > I take it on your page you have
    >
    > it's hard to know what's wrong without seeing the html...
    >
    > but looking at it, I'd expect to see:
    >
    > In the page:
    > <sometag:somecontrol1 id="mainHeader1" runat="server" />
    >
    > in somecontrol1:
    > <sometag:somecontrol2 id="sectionHeader1" runat="Server" />
    >
    > in somecontrol2:
    > <asp:label id="theSectionHeader" runat="erver" />
    >
    >
    > Then in page codebehind
    > protected mainHedaer1 as somecontrol
    >
    > sub page_load
    > mainHeader1.sectionHeader1.theSectionHeader.text = "Eritrea"
    > end sub
    >
    >
    > in somecontrol1 codebehind:
    > public sectionHeader1 as somecontrol2
    >
    >
    > in somecontrol2
    > public theSectionHeader as label
    >
    >
    > Karl
    > --
    > MY ASP.Net tutorials
    > http://www.openmymind.net/
    >
    >
    > "DC Gringo" <> wrote in message
    > news:...
    > > I've got a web user control (a) inside a web user control (b) inside a
    > > webform (c). I need the webform to set a label control text value

    inside
    > > the inner of the two web user control.
    > >
    > > Inside my web form's code behind I have:
    > >
    > > mainHeader1.sectionHeader1.theSectionHeader.text = "Eritrea"
    > > I'm getting "mainHeader1 is not declared" error.
    > >
    > > What am I doing wrong?
    > >
    > >
    > > --
    > > _____
    > > DC G
    > >
    > >

    >
    >
     
    DC Gringo, Sep 14, 2004
    #3
  4. DC Gringo

    DC Gringo Guest

    ooop....I got it!!! thanks Karl!!

    _____
    dc g


    "DC Gringo" <> wrote in message
    news:Os7jh$...
    > Karl,
    >
    > Thank you for your attention. I think I'm almost there. I did what you
    > said and still come up with:
    >
    > The base class includes the field 'SectionHeader1', but its type
    > (fn3p2.mainHeader) is not compatible with the type of control
    > (ASP.sectionHeader_ascx).
    >
    > Line 33: <UC1:SECTIONHEADER ID="SectionHeader1"
    > RUNAT="server"></UC1:SECTIONHEADER>
    >
    > Source File: D:\webs\projects\fewsnet\fn3.0\r3\mainHeader.ascx
    >
    > _____
    > DC G
    >
    >
    >
    >
    > "Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
    > message news:...
    > > you aren't declaring mainHeader1 *g*
    > >
    > > I take it on your page you have
    > >
    > > it's hard to know what's wrong without seeing the html...
    > >
    > > but looking at it, I'd expect to see:
    > >
    > > In the page:
    > > <sometag:somecontrol1 id="mainHeader1" runat="server" />
    > >
    > > in somecontrol1:
    > > <sometag:somecontrol2 id="sectionHeader1" runat="Server" />
    > >
    > > in somecontrol2:
    > > <asp:label id="theSectionHeader" runat="erver" />
    > >
    > >
    > > Then in page codebehind
    > > protected mainHedaer1 as somecontrol
    > >
    > > sub page_load
    > > mainHeader1.sectionHeader1.theSectionHeader.text = "Eritrea"
    > > end sub
    > >
    > >
    > > in somecontrol1 codebehind:
    > > public sectionHeader1 as somecontrol2
    > >
    > >
    > > in somecontrol2
    > > public theSectionHeader as label
    > >
    > >
    > > Karl
    > > --
    > > MY ASP.Net tutorials
    > > http://www.openmymind.net/
    > >
    > >
    > > "DC Gringo" <> wrote in message
    > > news:...
    > > > I've got a web user control (a) inside a web user control (b) inside a
    > > > webform (c). I need the webform to set a label control text value

    > inside
    > > > the inner of the two web user control.
    > > >
    > > > Inside my web form's code behind I have:
    > > >
    > > > mainHeader1.sectionHeader1.theSectionHeader.text = "Eritrea"
    > > > I'm getting "mainHeader1 is not declared" error.
    > > >
    > > > What am I doing wrong?
    > > >
    > > >
    > > > --
    > > > _____
    > > > DC G
    > > >
    > > >

    > >
    > >

    >
    >
     
    DC Gringo, Sep 14, 2004
    #4
  5. DC Gringo

    mfreidge

    Joined:
    Oct 3, 2006
    Messages:
    3
    The base class includes the field , but its type is not compatible

    I have similar error
    The base class includes the field 'ctlDateSelector', but its type (MyControls.DateSelector) is not compatible with the type of control (ASP.admin_dateselector_ascx).

    What you've done to fix it?


     
    mfreidge, Dec 17, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. titof
    Replies:
    0
    Views:
    584
    titof
    Jul 24, 2003
  2. timmso
    Replies:
    1
    Views:
    580
    Alex Papadimoulis
    Dec 12, 2003
  3. Neo Geshel
    Replies:
    2
    Views:
    1,125
    Neo Geshel
    Jun 14, 2005
  4. JohnZing

    declared or not declared ?

    JohnZing, Feb 5, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    1,623
    Jon Paal
    Feb 5, 2006
  5. DC Gringo
    Replies:
    3
    Views:
    226
    DC Gringo
    Sep 14, 2004
Loading...

Share This Page