Ask a questionAsk a question
 

Answer[custom control] has a circular reference!

  • Tuesday, November 07, 2006 4:29 PMamehrich Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I have a web app that was originally developed in VS 7/.NET 1 and has ran for some time without any issues. I recently imported the code into VS 8 TFS and have been stumped by one error. The error message is stemming from a custom user control that references another custom user control in the same project. The error message reads...

    header.ascx has a circular reference!

    In the header control I have a reference to a custom menu control which appears to relate to the problem...

    <%@ Register tagprefix="BB" Tagname="Menu" src="menu.ascx"%>

    ...

    <bb:menu id="PageMenu1" name="PageMenu1" runat="server"/>

    If I remove the reference to the menu.ascx custom control then the project builds successfully. Does anyone know how this build error can be resolved, or what VS 8/.NET 2 change in particular is causing this to be a problem when it was in VS 7/.NET 1?

    Thanks.

Answers

All Replies

  • Wednesday, November 08, 2006 5:54 PMDave Lubash - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    I think you will get a more directed response if you repost this on the ASP.NET forums   ( http://forums.asp.net ).  The search function on those forums shows about 30K hits on this line of questioning.

    http://forums.asp.net/search/SearchResults.aspx?q=circular+reference&o=Relevance

    Regards,
    Dave Lubash - Visual Studio Team Developer

  • Wednesday, June 04, 2008 12:20 PMshawinder Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     

    Circular reference means you are trying to access two controls by making reference to each other. In your case these controls are "menu" and "header". Now your header.ascx contains reference to "menu" similarly if you will check your menu.ascx...that would also contain reference to "header.ascx".

    This kind of situation is treated as ambiguous by the compiler so it simply throws the "circular reference" error.

    The best way to use such controls is to declare them in root .aspx page and then access them by using page.findcontrol()

     

    Thank you.

  • Friday, August 07, 2009 9:56 PMkaghhelen Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
  • Saturday, November 07, 2009 6:10 AMbluraydisc Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I have a web app that was originally developed in VS 7/.NET 1 and has ran for some time without any issues. I recently imported the code into VS 8 TFS and have been stumped by one error. The error message is stemming from a custom user control that references another custom user control in the same project. The error message reads...

    More powerful HD Video Converter and Rip Blu Ray

    header.ascx has a circular reference!

    In the header control I have a reference to a custom menu control which appears to relate to the problem...

    <%@ Register tagprefix ="BB" Tagname ="Menu" src ="menu.ascx" %>

    ...

    < bb : menu id ="PageMenu1" name ="PageMenu1" runat ="server"/>

    If I remove the reference to the menu.ascx custom control then the project builds successfully. Does anyone know how this build error can be resolved, or what VS 8/.NET 2 change in particular is causing this to be a problem when it was in VS 7/.NET 1?

    Thanks.




    As the users of Panasonic HDC-DX3,we will have problems to make our mts files to youtube.com.Now I find the MTS Video Converter to convert mts files to FLV. Then we can share our videos with our friends on youtube.com. Thanks a lot