not declared error- control inside a control inside a webform

  • Thread starter Thread starter DC Gringo
  • Start date Start date
D

DC Gringo

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?
 
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
 
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
 
ooop....I got it!!! thanks Karl!!

_____
dc g


DC Gringo said:
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
 
Back
Top