Nested user control causes build errors due to missing reference

  • Thread starter Thread starter Sebastian Paul
  • Start date Start date
S

Sebastian Paul

Hi,

I have a user control (EventStructureSelector) used in another user
control (ResultsMenu).

The class EventStructureSelector defines a public type (ModeType),
that is used for one of its properties (Mode). The class ResultsMenu
sets the property of the nested control during the PageLoad event.

No big thing for now.

But when adding the ResultsMenu control to a page, I get a build error
for the page (not the control):
The type 'EventStructureSelector.ModeType' is defined in an assembly
that is not referenced. You must add a reference to assembly
'App_Web_eventstructureselector.ascx.3933a83e.ma7j9ksk,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

Of course, I have correctly registered the ResultsMenu user control,
but that is not enough - I have to register EventStructureSelector!
This is strange, because the page has nothing to do with the nested
control, and the ResultsMenu control already has the Register
directive for EventStructureSelector.

Sure, one can live with it, but a user control should fully
encapsulate the nested controls.

I tried to register both controls globally in the web config, but I
got a similar error.

Best regards, Sebastian
 
..net compilers need to load all referenced libraries to do a compile,
thus when asp.net compiles a page, it needs to know this info.

-- bruce (sqlwork.com)
 
.net compilers need to load all referenced libraries to do a compile,
thus when asp.net compiles a page, it needs to know this info.
Sure. But it doesn't has this info. The ASP.NET compiler should
recognize the dependency between the controls, shouldn't he?
 
Back
Top