Solved

what does "Circular file references are not allowed" mean

Posted on 2004-10-28
552 Views
Last Modified: 2008-01-09
I am creating a usesr control dropdown menu.... it doesnt seem to like this--
<%@ Register TagPrefix="uc2" TagName="XmlHierMenusContro" Src="XmlHierMenusControl.ascx" %>

here is the rest of the code, pls help, am in deep problems. thanks

<%@ Control Language="vb" AutoEventWireup="false" Codebehind="XmlHierMenusControl.ascx.vb" Inherits="Webq.XmlHierMenusControl" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<%@ OutputCache Duration="120" VaryByParam="none" %>
<%@ Register TagPrefix="uc2" TagName="XmlHierMenusContro" Src="XmlHierMenusControl.ascx" %>
<link rel="STYLESHEET" type="text/css" href="menuStyle.css">
<script Language="JavaScript" src="XMLMenuScript.js"></script>
<table border="0" cellspacing="0" cellpadding="0" width="640">
      <tr align="left" valign="middle">
            <td bgcolor="#02027a" nowrap width="50">
                  &nbsp;
            </td>
            <td bgcolor="#02027a" align="left" nowrap>
                  <uc2:XmlHierMenusContro id="menus" runat="server" StartMenuName="Sites" StartMenuImage="images/yellow_arrow_down2.gif"
                        StartMenuStyle="font:10pt arial;font-weight:bold;color: #FFFFFF;text-decoration:none;cursor:hand" MenuImagePath="images/tri2.gif"
                        XmlFilePath="menuItems.xml" />
            </td>
            <td bgcolor="#02027a" nowrap width="50">
                  &nbsp;
            </td>
            <td bgcolor="#02027a" align="left" nowrap>
                  <uc2:XmlHierMenusContro id="menus2" runat="server" StartMenuName="PhoneBook" StartMenuImage="images/yellow_arrow_down2.gif"
                        StartMenuStyle="font:10pt arial;font-weight:bold;color: #FFFFFF;text-decoration:none;cursor:hand" MenuImagePath="images/tri2.gif"
                        XmlFilePath="menuItems2.xml" />
            </td>
      </tr>
</table>

0
Question by:SirReadAlot
    54 Comments
     

    Author Comment

    by:SirReadAlot
    pls help
    0
     
    LVL 8

    Assisted Solution

    by:toddhd
    If I'm reading the above correctly, you are creating a user control called XmlHierMenusControl that imports a third-party control called XmlHierMenusControl. And that would be your circular reference - the IDE thinks your control is trying to reference itself, which would create a never ending loop.

    Rename your User Control, or at least the application.

    Or - now looking again, I see that the first line states "Inherits=XmlHierMenusControl.ascx", and then two lines down, your are registering that same control.
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    are your referencing a project that references your project?
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    I agree its trying to reference your control from inside your control.
    0
     

    Author Comment

    by:SirReadAlot
    what is tj ecorrect format
    0
     

    Author Comment

    by:SirReadAlot
    this is waht comes with the original code  
    <%@ Register TagPrefix="wc" Namespace="XMLHierMenus" Assembly="WC.XmlHierMenus" %>
    this is mine
    <%@ Register TagPrefix="uc2" TagName="XmlHierMenusControl" Src="XmlHierMenusControl.ascx" Assembly="uc2.XmlHierMenus"%>

    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    The project name is AJBoydJeep
    k in my control called header
    <%@ Control Language="vb" AutoEventWireup="false" Codebehind="Header.ascx.vb" Inherits="AJBoydJeep.Header" %>
    Then in any given page containing the header
    <%@ Register TagPrefix="uc1" TagName="Header" Src="Header.ascx" %>

    0
     
    LVL 33

    Assisted Solution

    by:raterus
    It probably goes deeper than just those two lines.
    0
     
    LVL 17

    Assisted Solution

    by:AerosSaga
    So probably some confusion among the control and the assembly?
    0
     

    Author Comment

    by:SirReadAlot
    i try this
    0
     

    Author Comment

    by:SirReadAlot
    no assembly came with the code, all i saw that did not make sence is somthing with this extension
    XmlHierMenus.cmd
    0
     

    Author Comment

    by:SirReadAlot
    could this be the assembly
    0
     

    Author Comment

    by:SirReadAlot
    this is the code behind of the usercontrol

    Imports System
    Imports System.Web
    Imports System.Web.UI
    Imports System.Web.UI.WebControls
    Imports System.ComponentModel
    Imports System.Xml
    Imports System.IO
    Imports System.Text
    Imports System.Collections
    Namespace XMLHierMenus
        Public Class XmlHierMenusControl
            Inherits System.Web.UI.UserControl
            Private _arrayHolderArray As New ArrayList
            Private _arrayNamesArray As New ArrayList
            Private _xmlFilePath As String = [String].Empty
            Private _startMenuName As String = [String].Empty
            Private _strImage As String = [String].Empty
            Private _startMenuImage As String = [String].Empty
            Private _startMenuStyle As String = [String].Empty
            Private _startMenuLinkText As String = [String].Empty
            Private _strCurrentMenu As String = [String].Empty
            Private _intLevel As Integer = 1
            Private _strSaveToFilePath As String = [String].Empty
            Private _context As HttpContext = HttpContext.Current

    #Region " Web Form Designer Generated Code "

            'This call is required by the Web Form Designer.
            <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

            End Sub

            'NOTE: The following placeholder declaration is required by the Web Form Designer.
            'Do not delete or move it.
            Private designerPlaceholderDeclaration As System.Object

            Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
                'CODEGEN: This method call is required by the Web Form Designer
                'Do not modify it using the code editor.
                InitializeComponent()
            End Sub

    #End Region
            Public Property StartMenuName() As String
                Get
                    Return _startMenuName
                End Get
                Set(ByVal Value As String)
                    _startMenuName = Value
                End Set
            End Property


            Public Property MenuImagePath() As String
                Get
                    Return _strImage
                End Get
                Set(ByVal Value As String)
                    _strImage = Value
                End Set
            End Property


            Public Property StartMenuStyle() As String
                Get
                    Return _startMenuStyle
                End Get
                Set(ByVal Value As String)
                    _startMenuStyle = Value
                End Set
            End Property


            Public Property StartMenuImage() As String
                Get
                    Return _startMenuImage
                End Get
                Set(ByVal Value As String)
                    _startMenuImage = Value
                End Set
            End Property


            Public Property XmlFilePath() As String
                Get
                    Return _xmlFilePath
                End Get
                Set(ByVal Value As String)
                    _xmlFilePath = Value
                End Set
            End Property



            Protected Overrides Sub Render(ByVal output As HtmlTextWriter)
                If Me.StartMenuImage = [String].Empty Then
                    output.Write("StartMenuName not supplied.  The XML menus cannot initialize")
                Else
                    output.Write(("<a id=""" + Me.StartMenuName + "_link" + """ onClick=""startIt('" + Me.StartMenuName + "',this,0)"" style=""" + Me.StartMenuStyle + """>" + Me.StartMenuName))
                    If Me.StartMenuImage <> [String].Empty Then
                        output.Write(("<img src=""" + Me.StartMenuImage + """ border=""0"">"))
                    End If
                    output.Write("</a>")
                    output.Write((ControlChars.Lf + ControlChars.Lf + CreateMenu()))
                End If
            End Sub 'Render


            Public Function CreateMenu() As String
                Dim strOutput As New StringBuilder
                Dim i As Integer = 0
                Dim startArray As New ArrayList
                Dim strVariable As String = ""
                Dim strTemp As String = ""

                Dim XMLDoc As New XmlDocument
                Try
                    XMLDoc.Load(CheckFilePath(_xmlFilePath))
                Catch exc As Exception
                    strOutput.Append(exc.Message)
                    Return strOutput.ToString()
                End Try

                Dim nodeList As XmlNodeList = XMLDoc.DocumentElement.ChildNodes

                Dim node As XmlNode
                For Each node In nodeList

                    Dim currentNode As XmlNode = node
                    If currentNode.HasChildNodes = True And currentNode.ChildNodes.Count > 1 Then
                        _strCurrentMenu = _startMenuName + "_" + (i + 1)
                        Dim thisMenu As String = _startMenuName
                        If currentNode.ChildNodes.Count > 2 Then
                            strVariable = "<span id=""" & thisMenu & "_span" & (i + 1) & """ class='cellOff' onMouseOver=""stateChange('" & _strCurrentMenu & "',this," & _intLevel & ")"" onMouseOut=""stateChange('',this,'')"">" & "<img align=""right"" vspace=""2"" border=""0"" src=""" & _strImage & """>" & currentNode.ChildNodes(1).InnerText & "</span><br>" & ControlChars.Lf
                            startArray.Add(strVariable)
                            WalkTree(currentNode)
                        Else
                            strVariable = "<span id=""" & thisMenu & "_span" & (i + 1) & """ class='cellOff' onMouseOver=""stateChange('',this,'');hideDiv(" & _intLevel & ")"" onMouseOut=""stateChange('',this,'')"" onClick=""location.href='" & currentNode.ChildNodes(0).InnerText & "'"">" & currentNode.ChildNodes(1).InnerText & "</span><br>" & ControlChars.Lf
                            startArray.Add(strVariable)
                        End If
                    End If
                    i += 1
                Next node

                startArray.TrimToSize()
                _arrayNamesArray.Add(_startMenuName)
                For i = 0 To startArray.Count - 1
                    strTemp += startArray(i)
                Next i
                _arrayHolderArray.Add(strTemp)

                'Reverse Array order so we don't have to worry about the ZIndex of each div layer
                _arrayHolderArray.Reverse()
                _arrayNamesArray.Reverse()

                'Loop through arrays and write out divs and their individual span content items
                For i = 0 To _arrayNamesArray.Count - 1
                    strOutput.Append(("<div id='" + _arrayNamesArray(i).ToString() + "' class='clsMenu'>"))
                    strOutput.Append(_arrayHolderArray(i).ToString())
                    strOutput.Append("</div>" + ControlChars.Lf)
                Next i
                _arrayHolderArray.Clear()
                _arrayNamesArray.Clear()

                'if (_blnStaticMenus) {
                '
                Dim writer As StreamWriter = New StreamWriter(File.Open(_strSaveToFilePath, FileMode.OpenOrCreate, FileAccess.Write))
                '
                writer.Write(strOutput.ToString())
                '
                writer.Flush()
                '
                If Not writer Is Nothing Then writer.Close()
                '

                Return strOutput.ToString()
            End Function 'CreateMenu
            'CreateMenus
            Private Sub WalkTree(ByVal node As XmlNode)
                _intLevel += 1
                Dim strVariable As String = ""
                Dim strTemp As String = ""
                Dim tempArray As New ArrayList

                Dim j As Integer
                For j = 2 To node.ChildNodes.Count - 1
                    Dim newNode As XmlNode = node.ChildNodes(j)

                    If newNode.HasChildNodes = True And newNode.ChildNodes.Count > 2 Then ' Each node should have a 0=hyperlink and 1=text node so don't call the function again if there are just these children
                        _strCurrentMenu += "_" + (j - 1)
                        Dim thisMenu As String = _strCurrentMenu.Substring(0, _strCurrentMenu.Length - 2)
                        strVariable = "<span id=""" & thisMenu & "_span" & (j - 1) & """ class='cellOff' onMouseOver=""stateChange('" & _strCurrentMenu & "',this," & _intLevel & ")"" onMouseOut=""stateChange('',this,'')"">" & "<img align=""right"" vspace=""2"" border=""0"" src=""" & _strImage & """>" & newNode.ChildNodes(1).InnerText & "</span><br>" & ControlChars.Lf
                        tempArray.Add(strVariable)
                        WalkTree(newNode)
                    Else
                        strVariable = "<span id=""" & _strCurrentMenu & "_span" & (j - 1) & """ class='cellOff' onMouseOver=""stateChange('',this,'');hideDiv(" & _intLevel & ")"" onMouseOut=""stateChange('',this,'')"" onClick=""location.href='" & newNode.ChildNodes(0).InnerText & "'"">" & newNode.ChildNodes(1).InnerText & "</span><br>" & ControlChars.Lf
                        tempArray.Add(strVariable)
                    End If
                Next j

                tempArray.TrimToSize()
                _arrayNamesArray.Add(_strCurrentMenu)
                Dim i As Integer
                For i = 0 To tempArray.Count - 1
                    strTemp += tempArray(i)
                Next i
                _arrayHolderArray.Add(strTemp)
                _strCurrentMenu = _strCurrentMenu.Substring(0, _strCurrentMenu.Length - 2) 'Exiting function so go back to previous menu version
                _intLevel -= 1
                tempArray.Clear()
            End Sub 'WalkTree
            ' WalkTree
            Private Function CheckFilePath(ByVal path As String) As String
                If path.IndexOf("\:") = -1 And path.ToUpper().IndexOf("HTTP://") = -1 Then
                    path = context.Server.MapPath(path)
                End If
                Return path
            End Function 'CheckFilePath
            Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
                'Put user code to initialize the page here
            End Sub


        End Class 'XmlMenu
    End Namespace 'XMLHierMenus
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    I'm guessn thats a script of some kind.
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    the .cmd file that is
    0
     

    Author Comment

    by:SirReadAlot
    this works well, I just need to sortout the user control referencing, any suggestions
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    try deleting your usercontrol recreating it with a different name and see if the condition still exists.
    0
     
    LVL 8

    Accepted Solution

    by:
    There is stuff all over the place here

    You namespace and class look like this:
    Namespace XMLHierMenus
        Public Class XmlHierMenusControl

    And you are importing a component of the same name. The Namespace might help you, but I keep seeing different namespaces, such as:
    Webq.XmlHierMenusControl
    WC.XmlHierMenus
    uc2.XmlHierMenus

    I would seriously start by NOT naming your class and namespace the same as the control you are importing
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    hehe I agree
    0
     

    Author Comment

    by:SirReadAlot
    wc.xml... came from the example. am not using that.

    webq{name off appliccation}
    XmlHierMenusControl{is the name of the user control}

    what can i change
    0
     
    LVL 8

    Expert Comment

    by:toddhd
    Change :
    Namespace XMLHierMenus
        Public Class XmlHierMenusControl

    To:
    Namespace myXMLHierMenus
        Public Class myXmlHierMenusControl
    0
     

    Author Comment

    by:SirReadAlot
    ok, thanks for that.

    but its still erroring here <%@ Register TagPrefix="uc2" TagName="XmlHierMenusControl" Src="XmlHierMenusControl.ascx"%>

    error says---------Circular file references are not allowed

    what do i need?

    mean while i shall try  <%@ Register TagPrefix="uc2" TagName="myXmlHierMenusControl" Src="myXmlHierMenusControl.ascx"%>

    0
     

    Author Comment

    by:SirReadAlot
    no joy, still giving errors  Circular file references are not allowed
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    theres something screwy with this assembly do you have the url for the developers?
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    also did you try deleting and then recreating the user control?
    0
     

    Author Comment

    by:SirReadAlot
    this is the exact location---http://www.xmlforasp.net/codeSection.aspx?csID=19

    title is ASP.NET XML Hierarchical Menus Server Control
    0
     

    Author Comment

    by:SirReadAlot
    i didnot include the assembly, the stuff i saw didnot indicate that its an assembly
    0
     
    LVL 8

    Expert Comment

    by:toddhd
    Ok, ok, hang on here - get some coffee...

    Look at the first line:
    <%@ Control Language="vb" AutoEventWireup="false" Codebehind="XmlHierMenusControl.ascx.vb" Inherits="Webq.XmlHierMenusControl" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>

    This line should be referencing your code behind. The code behind name should be the same as the web page, but with .vb instead of aspx. Also, typically (though not required), the name of the codebehind class will also be the same. So if your page was called MyWebpage.aspx, then there should be a MyWebPage.vb file as well, and the line above would read CodeBehind="MyWebPage.vb". And in the MyWebPage.vb file, there would be a line that starts with Class MyWebPage.

    This line:
    <%@ Register TagPrefix="uc2" TagName="XmlHierMenusContro" Src="XmlHierMenusControl.ascx" %>

    Is registering a control or class is outside of the namespace of your control. It is typically a *.dll file in your bin, or could be class file, which is the case here I believe.

    I think your problem here is that all of these things are being given similar names, and that you are also trying to inherit the base web page from a menu control.

    Where did you get this control, or the code for it? Maybe we can start there...
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    what version of the framework are you using?

    ASP.NET XML Hierarchical Menus Server Control
    Description       

    The XML Hierarchical Menus Server Control improves upon the initial version by encapsulating all of the code into an ASP.NET server control. Doing this allows people with little to no experience with programming C# or VB.NET to integrate the menus into ASP.NET pages. The application demonstrates how the DOM can be used to dynamically create a menu structure similar to the Start menu in Windows that can be used in IE4+.
    Teaches       ASP.NET, XmlDocument, XmlNode, XmlNodeList, etc., DHTML, JavaScript, C#
    Requirements       .NET Version 1.0 ***********************************
    Example:       Click Here
    View Source Code:       Click Here
    Download Code:       Click Here
    0
     

    Author Comment

    by:SirReadAlot
    1.1
    0
     

    Author Comment

    by:SirReadAlot
    it should still work, as its above 1.0
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    their .ascx
    <%@ Control ClassName="XmlMenusUserControl" %>
    <%@ OutputCache Duration="120" VaryByParam="none" %>
    <%@ Register TagPrefix="wc" Namespace="XMLHierMenus" Assembly="WC.XmlHierMenus" %>

    their .aspx
    <%@ Page Inherits="System.Web.UI.Page" %>
    <%@ Register Tagprefix="wc" Tagname="XmlMenuControl" Src="XmlHierMenusControl.ascx" %>
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    You should have used:
    http://skmmenu.com/menu/
    0
     

    Author Comment

    by:SirReadAlot
    if u can tell me what to do with this
    csc.exe /t:library /out:D:\Inetpub\wwwroot\xmlforasp\bin\WC.XmlHierMenus.dll /r:System.Web.dll /r:System.Xml.dll D:\Inetpub\wwwroot\xmlforasp\codebank\menus\XmlMenusControl\XmlHierMenusControl.cs
    pause

    maybe it would work


    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    not neccesarily SirReadAlot
    0
     

    Author Comment

    by:SirReadAlot
    the people i work for dont want to use that. THATS WHY AM IN SO MUCH TROBLE
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    csc.exe /t:library /out:D:\Inetpub\wwwroot\xmlforasp\bin\WC.XmlHierMenus.dll /r:System.Web.dll /r:System.Xml.dll D:\Inetpub\wwwroot\xmlforasp\codebank\menus\XmlMenusControl\XmlHierMenusControl.cs
    pause

    I'm assuming that includes the assembly in the compilation.
    0
     
    LVL 8

    Expert Comment

    by:toddhd
    Oh my lord, this is the most complicated menu system... I love this line especially:

    ...Doing this allows people with little to no experience with programming C# or VB.NET to integrate the menus into ASP.NET pages...

    Yeah - they made this real simple for ya :)
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    I personally have never used the comand line compiler, I code in VB.NET.  Sorry:(
    0
     

    Author Comment

    by:SirReadAlot
    yeh they really messed things up for me and the manager needs this menu
    0
     
    LVL 8

    Expert Comment

    by:toddhd
    Try this please - remove this part:
    Inherits="Webq.XmlHierMenusControl"

    from the first line
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    have you contacted the developer?
    0
     

    Author Comment

    by:SirReadAlot
    they never reply
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    hehe what a surprise
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    I can see why, lol
    0
     

    Author Comment

    by:SirReadAlot
    Inherits="Webq.XmlHierMenusControl"
    done that still no differnce
    0
     

    Author Comment

    by:SirReadAlot
    y
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    y do I think they would never reply, because I think they would probably get this a lot, and its free
    0
     

    Author Comment

    by:SirReadAlot
    ok, guess am stuck.  I do have a menu that works but it i cant make it turn into a sub menu i.e

    File
    -----add file (but i can acheive this)
             |--- xyz( i can't achieve this)
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    0
     

    Author Comment

    by:SirReadAlot
    i fink its the same as skm
    0
     

    Author Comment

    by:SirReadAlot
    i will read it properly
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    what functionality does skmmenu lack that your after?
    0
     

    Author Comment

    by:SirReadAlot
    not that. the software we are building is going to be sold, so these guys don't want any foreign dlls etc
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    Course: From Zero to Hero with Nodejs & MongoDB

    Interested in Node.js, but don't know where to start or how to learn it properly? Confused about how the MEAN stack pieces of MongoDB, Expressjs, Angularjs, and Nodejs fit together? Or how it's even possible to run JavaScript outside of the browser?

    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    875 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now