Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

what does "Circular file references are not allowed" mean

Posted on 2004-10-28
54
Medium Priority
?
569 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
Comment
Question by:SirReadAlot
  • 25
  • 22
  • 6
  • +1
54 Comments
 

Author Comment

by:SirReadAlot
ID: 12433246
pls help
0
 
LVL 8

Assisted Solution

by:toddhd
toddhd earned 800 total points
ID: 12433284
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
ID: 12433291
are your referencing a project that references your project?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Expert Comment

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

Author Comment

by:SirReadAlot
ID: 12433340
what is tj ecorrect format
0
 

Author Comment

by:SirReadAlot
ID: 12433347
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
ID: 12433368
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
raterus earned 400 total points
ID: 12433370
It probably goes deeper than just those two lines.
0
 
LVL 17

Assisted Solution

by:AerosSaga
AerosSaga earned 800 total points
ID: 12433381
So probably some confusion among the control and the assembly?
0
 

Author Comment

by:SirReadAlot
ID: 12433394
i try this
0
 

Author Comment

by:SirReadAlot
ID: 12433423
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
ID: 12433431
could this be the assembly
0
 

Author Comment

by:SirReadAlot
ID: 12433446
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
ID: 12433480
I'm guessn thats a script of some kind.
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12433503
the .cmd file that is
0
 

Author Comment

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

Expert Comment

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

Accepted Solution

by:
toddhd earned 800 total points
ID: 12433526
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
ID: 12433546
hehe I agree
0
 

Author Comment

by:SirReadAlot
ID: 12433559
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
ID: 12433604
Change :
Namespace XMLHierMenus
    Public Class XmlHierMenusControl

To:
Namespace myXMLHierMenus
    Public Class myXmlHierMenusControl
0
 

Author Comment

by:SirReadAlot
ID: 12433661
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
ID: 12433691
no joy, still giving errors  Circular file references are not allowed
0
 
LVL 17

Expert Comment

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

Expert Comment

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

Author Comment

by:SirReadAlot
ID: 12433742
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
ID: 12433757
i didnot include the assembly, the stuff i saw didnot indicate that its an assembly
0
 
LVL 8

Expert Comment

by:toddhd
ID: 12433784
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
ID: 12433795
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
ID: 12433806
1.1
0
 

Author Comment

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

Expert Comment

by:AerosSaga
ID: 12433823
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
ID: 12433833
You should have used:
http://skmmenu.com/menu/
0
 

Author Comment

by:SirReadAlot
ID: 12433848
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
ID: 12433854
not neccesarily SirReadAlot
0
 

Author Comment

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

Expert Comment

by:AerosSaga
ID: 12433869
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
ID: 12433884
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
ID: 12433885
I personally have never used the comand line compiler, I code in VB.NET.  Sorry:(
0
 

Author Comment

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

Expert Comment

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

from the first line
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12433918
have you contacted the developer?
0
 

Author Comment

by:SirReadAlot
ID: 12433937
they never reply
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12433948
hehe what a surprise
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12433954
I can see why, lol
0
 

Author Comment

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

Author Comment

by:SirReadAlot
ID: 12433966
y
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12433986
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
ID: 12434020
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
 

Author Comment

by:SirReadAlot
ID: 12434142
i fink its the same as skm
0
 

Author Comment

by:SirReadAlot
ID: 12434150
i will read it properly
0
 
LVL 17

Expert Comment

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

Author Comment

by:SirReadAlot
ID: 12434237
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

916 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