• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 574
  • Last Modified:

what does "Circular file references are not allowed" mean

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
SirReadAlot
Asked:
SirReadAlot
  • 25
  • 22
  • 6
  • +1
4 Solutions
 
SirReadAlotAuthor Commented:
pls help
0
 
toddhdCommented:
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
 
AerosSagaCommented:
are your referencing a project that references your project?
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
AerosSagaCommented:
I agree its trying to reference your control from inside your control.
0
 
SirReadAlotAuthor Commented:
what is tj ecorrect format
0
 
SirReadAlotAuthor Commented:
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
 
AerosSagaCommented:
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
 
raterusCommented:
It probably goes deeper than just those two lines.
0
 
AerosSagaCommented:
So probably some confusion among the control and the assembly?
0
 
SirReadAlotAuthor Commented:
i try this
0
 
SirReadAlotAuthor Commented:
no assembly came with the code, all i saw that did not make sence is somthing with this extension
XmlHierMenus.cmd
0
 
SirReadAlotAuthor Commented:
could this be the assembly
0
 
SirReadAlotAuthor Commented:
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
 
AerosSagaCommented:
I'm guessn thats a script of some kind.
0
 
AerosSagaCommented:
the .cmd file that is
0
 
SirReadAlotAuthor Commented:
this works well, I just need to sortout the user control referencing, any suggestions
0
 
AerosSagaCommented:
try deleting your usercontrol recreating it with a different name and see if the condition still exists.
0
 
toddhdCommented:
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
 
AerosSagaCommented:
hehe I agree
0
 
SirReadAlotAuthor Commented:
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
 
toddhdCommented:
Change :
Namespace XMLHierMenus
    Public Class XmlHierMenusControl

To:
Namespace myXMLHierMenus
    Public Class myXmlHierMenusControl
0
 
SirReadAlotAuthor Commented:
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
 
SirReadAlotAuthor Commented:
no joy, still giving errors  Circular file references are not allowed
0
 
AerosSagaCommented:
theres something screwy with this assembly do you have the url for the developers?
0
 
AerosSagaCommented:
also did you try deleting and then recreating the user control?
0
 
SirReadAlotAuthor Commented:
this is the exact location---http://www.xmlforasp.net/codeSection.aspx?csID=19

title is ASP.NET XML Hierarchical Menus Server Control
0
 
SirReadAlotAuthor Commented:
i didnot include the assembly, the stuff i saw didnot indicate that its an assembly
0
 
toddhdCommented:
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
 
AerosSagaCommented:
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
 
SirReadAlotAuthor Commented:
1.1
0
 
SirReadAlotAuthor Commented:
it should still work, as its above 1.0
0
 
AerosSagaCommented:
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
 
AerosSagaCommented:
You should have used:
http://skmmenu.com/menu/
0
 
SirReadAlotAuthor Commented:
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
 
AerosSagaCommented:
not neccesarily SirReadAlot
0
 
SirReadAlotAuthor Commented:
the people i work for dont want to use that. THATS WHY AM IN SO MUCH TROBLE
0
 
AerosSagaCommented:
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
 
toddhdCommented:
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
 
AerosSagaCommented:
I personally have never used the comand line compiler, I code in VB.NET.  Sorry:(
0
 
SirReadAlotAuthor Commented:
yeh they really messed things up for me and the manager needs this menu
0
 
toddhdCommented:
Try this please - remove this part:
Inherits="Webq.XmlHierMenusControl"

from the first line
0
 
AerosSagaCommented:
have you contacted the developer?
0
 
SirReadAlotAuthor Commented:
they never reply
0
 
AerosSagaCommented:
hehe what a surprise
0
 
AerosSagaCommented:
I can see why, lol
0
 
SirReadAlotAuthor Commented:
Inherits="Webq.XmlHierMenusControl"
done that still no differnce
0
 
SirReadAlotAuthor Commented:
y
0
 
AerosSagaCommented:
y do I think they would never reply, because I think they would probably get this a lot, and its free
0
 
SirReadAlotAuthor Commented:
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
 
SirReadAlotAuthor Commented:
i fink its the same as skm
0
 
SirReadAlotAuthor Commented:
i will read it properly
0
 
AerosSagaCommented:
what functionality does skmmenu lack that your after?
0
 
SirReadAlotAuthor Commented:
not that. the software we are building is going to be sold, so these guys don't want any foreign dlls etc
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 25
  • 22
  • 6
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now