Answered by:
The following style sheet contains a circular reference to an external style sheet

Question
-
User-375488743 posted
Hi all,
I have a mobile web form with an ObjectList and a StyleSheet controls. This StyleSheet references to an external StyleSheet located in a mobile web user control.
When I use the DataBind() method of the ObjectList, I receive the following message: "The following style sheet contains a circular reference to an external style sheet:".
If I use an internal StyleSheet instead of an external StyleSheet, everything is ok.
I need to use external StyleSheet, so can anybody help me?
Wednesday, August 30, 2006 8:07 AM
Answers
-
User-1208438202 posted
Hi Mr xesteban,
sorry for this delay...
i was some what busy... ok. the mistake is that you are using the Reference path in line no.4 .
ReferencePath is meant for using usercontrol stylesheet..
here you are Referening the same usercontrol as reference for itself...
there the circular reference happens ...
to avois this remove this reference path from usercontrl and use the referencepath in the aspx page only... then its ok...
Use this line instead of that one.. (Replacement for 4th line)
<mobile:StyleSheet id="StyleSheet1" runat="server">
Your code:
1 <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
2 <%@ Control Language="vb" AutoEventWireup="false" Codebehind="mwucStyleSheet.ascx.vb" Inherits="Consultas.mwucStyleSheet" TargetSchema="http://schemas.microsoft.com/Mobile/WebUserControl" %>
3 <P>
4 <mobile:StyleSheet id="StyleSheet1" runat="server" ReferencePath="mwucStyleSheet.ascx">
5 <mobile:Style Name="Link">
6 <DeviceSpecific>
7 <Choice Filter="isHTML32" Xmlns="http://schemas.microsoft.com/mobile/html32template"></Choice>
8 </DeviceSpecific>
9 </mobile:Style>
10 <mobile:Style Name="Textbox"></mobile:Style>
11 <mobile:Style Name="Button"></mobile:Style>
12 <mobile:Style ForeColor="Green" Name="Label"></mobile:Style>
13 <mobile:Style ForeColor="Green" Name="Label2"></mobile:Style>
14 </mobile:StyleSheet>
15 </P>- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, September 5, 2006 12:52 AM
All replies
-
User-1208438202 posted
Hi xesteban
can u post ur code...
Thursday, August 31, 2006 2:42 AM -
User-375488743 posted
hi jpsaravanan, this is my code:
.aspx:
1 <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> 2 <%@ Page Language="vb" AutoEventWireup="false" Codebehind="frmProductos.aspx.vb" Inherits="Consultas.frmProductos" %> 3 <HEAD> 4 <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR"> 5 <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE"> 6 <meta content="http://schemas.microsoft.com/Mobile/Page" name="vs_targetSchema"> 7 </HEAD> 8 <body Xmlns:mobile="http://schemas.microsoft.com/Mobile/WebForm"> 9 <mobile:form id="Productos" runat="server"> 10 <mobile:Label id="Label3" runat="server" StyleReference="Label">Productos</mobile:Label> 11 <mobile:Label id="Label4" runat="server"></mobile:Label> 12 <mobile:TextBox id="TextBox1" runat="server"></mobile:TextBox> 13 <mobile:Command id="Command1" runat="server">Buscar</mobile:Command> 14 <mobile:ObjectList id="lstProductos" runat="server" LabelStyle-StyleReference="title" CommandStyle-StyleReference="subcommand"></mobile:ObjectList> 15 </mobile:form> 16 <mobile:StyleSheet id="StyleSheet1" runat="server" ReferencePath="../mwucStyleSheet.ascx"></mobile:StyleSheet> 17 </body>
code behind:
1 Public Class frmProductos 2 Inherits System.Web.UI.MobileControls.MobilePage 3 Protected WithEvents Command1 As System.Web.UI.MobileControls.Command 4 Protected WithEvents TextBox1 As System.Web.UI.MobileControls.TextBox 5 Protected WithEvents Label4 As System.Web.UI.MobileControls.Label 6 Protected WithEvents Label3 As System.Web.UI.MobileControls.Label 7 Protected WithEvents Productos As System.Web.UI.MobileControls.Form 8 Protected WithEvents StyleSheet1 As System.Web.UI.MobileControls.StyleSheet 9 Protected WithEvents lstProductos As System.Web.UI.MobileControls.ObjectList 10 11 #Region " Web Form Designer Generated Code " 12 13 'This call is required by the Web Form Designer. 14 <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() 15 16 End Sub 17 18 Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 19 'CODEGEN: This method call is required by the Web Form Designer 20 'Do not modify it using the code editor. 21 InitializeComponent() 22 End Sub 23 24 #End Region 25 26 Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 27 Dim arrProductos As New ArrayList 28 29 arrProductos.Add(New clsProducto("p1", "Almohadilla eléctrica")) 30 arrProductos.Add(New clsProducto("p2", "Bolsa agua forrada")) 31 32 lstProductos.TableFields = "Identificador;Nombre" 33 lstProductos.LabelField = "Identificador" 34 35 lstProductos.DataSource = arrProductos 36 lstProductos.Databind() 37 End Sub 38 End Class
mobile web user control taht contains ths external StyleSheet:
1 <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> 2 <%@ Control Language="vb" AutoEventWireup="false" Codebehind="mwucStyleSheet.ascx.vb" Inherits="Consultas.mwucStyleSheet" TargetSchema="http://schemas.microsoft.com/Mobile/WebUserControl" %> 3 <P> 4 <mobile:StyleSheet id="StyleSheet1" runat="server" ReferencePath="mwucStyleSheet.ascx"> 5 <mobile:Style Name="Link"> 6 <DeviceSpecific> 7 <Choice Filter="isHTML32" Xmlns="http://schemas.microsoft.com/mobile/html32template"></Choice> 8 </DeviceSpecific> 9 </mobile:Style> 10 <mobile:Style Name="Textbox"></mobile:Style> 11 <mobile:Style Name="Button"></mobile:Style> 12 <mobile:Style ForeColor="Green" Name="Label"></mobile:Style> 13 <mobile:Style ForeColor="Green" Name="Label2"></mobile:Style> 14 </mobile:StyleSheet> 15 </P>
thank you.
Thursday, August 31, 2006 3:18 AM -
User-375488743 posted
hi jpsaravanan, this is my code:
.aspx:
1 <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> 2 <%@ Page Language="vb" AutoEventWireup="false" Codebehind="frmProductos.aspx.vb" Inherits="Consultas.frmProductos" %> 3 <HEAD> 4 <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR"> 5 <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE"> 6 <meta content="http://schemas.microsoft.com/Mobile/Page" name="vs_targetSchema"> 7 </HEAD> 8 <body Xmlns:mobile="http://schemas.microsoft.com/Mobile/WebForm"> 9 <mobile:form id="Productos" runat="server"> 10 <mobile:Label id="Label3" runat="server" StyleReference="Label">Productos</mobile:Label> 11 <mobile:Label id="Label4" runat="server"></mobile:Label> 12 <mobile:TextBox id="TextBox1" runat="server"></mobile:TextBox> 13 <mobile:Command id="Command1" runat="server">Buscar</mobile:Command> 14 <mobile:ObjectList id="lstProductos" runat="server" LabelStyle-StyleReference="title" CommandStyle-StyleReference="subcommand"></mobile:ObjectList> 15 </mobile:form> 16 <mobile:StyleSheet id="StyleSheet1" runat="server" ReferencePath="../mwucStyleSheet.ascx"></mobile:StyleSheet> 17 </body>
code behind:
1 Public Class frmProductos 2 Inherits System.Web.UI.MobileControls.MobilePage 3 Protected WithEvents Command1 As System.Web.UI.MobileControls.Command 4 Protected WithEvents TextBox1 As System.Web.UI.MobileControls.TextBox 5 Protected WithEvents Label4 As System.Web.UI.MobileControls.Label 6 Protected WithEvents Label3 As System.Web.UI.MobileControls.Label 7 Protected WithEvents Productos As System.Web.UI.MobileControls.Form 8 Protected WithEvents StyleSheet1 As System.Web.UI.MobileControls.StyleSheet 9 Protected WithEvents lstProductos As System.Web.UI.MobileControls.ObjectList 10 11 #Region " Web Form Designer Generated Code " 12 13 'This call is required by the Web Form Designer. 14 <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() 15 16 End Sub 17 18 Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 19 'CODEGEN: This method call is required by the Web Form Designer 20 'Do not modify it using the code editor. 21 InitializeComponent() 22 End Sub 23 24 #End Region 25 26 Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 27 Dim arrProductos As New ArrayList 28 29 arrProductos.Add(New clsProducto("p1", "Almohadilla eléctrica")) 30 arrProductos.Add(New clsProducto("p2", "Bolsa agua forrada")) 31 32 lstProductos.TableFields = "Identificador;Nombre" 33 lstProductos.LabelField = "Identificador" 34 35 lstProductos.DataSource = arrProductos 36 lstProductos.Databind() 37 End Sub 38 End Class
mobile web user control taht contains ths external StyleSheet:
1 <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> 2 <%@ Control Language="vb" AutoEventWireup="false" Codebehind="mwucStyleSheet.ascx.vb" Inherits="Consultas.mwucStyleSheet" TargetSchema="http://schemas.microsoft.com/Mobile/WebUserControl" %> 3 <P> 4 <mobile:StyleSheet id="StyleSheet1" runat="server" ReferencePath="mwucStyleSheet.ascx"> 5 <mobile:Style Name="Link"> 6 <DeviceSpecific> 7 <Choice Filter="isHTML32" Xmlns="http://schemas.microsoft.com/mobile/html32template"></Choice> 8 </DeviceSpecific> 9 </mobile:Style> 10 <mobile:Style Name="Textbox"></mobile:Style> 11 <mobile:Style Name="Button"></mobile:Style> 12 <mobile:Style ForeColor="Green" Name="Label"></mobile:Style> 13 <mobile:Style ForeColor="Green" Name="Label2"></mobile:Style> 14 </mobile:StyleSheet> 15 </P>
thank you.
Thursday, August 31, 2006 3:18 AM -
User-375488743 posted
sorry, I posted two times..Thursday, August 31, 2006 3:20 AM -
User-1208438202 posted
Hi Mr xesteban,
sorry for this delay...
i was some what busy... ok. the mistake is that you are using the Reference path in line no.4 .
ReferencePath is meant for using usercontrol stylesheet..
here you are Referening the same usercontrol as reference for itself...
there the circular reference happens ...
to avois this remove this reference path from usercontrl and use the referencepath in the aspx page only... then its ok...
Use this line instead of that one.. (Replacement for 4th line)
<mobile:StyleSheet id="StyleSheet1" runat="server">
Your code:
1 <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
2 <%@ Control Language="vb" AutoEventWireup="false" Codebehind="mwucStyleSheet.ascx.vb" Inherits="Consultas.mwucStyleSheet" TargetSchema="http://schemas.microsoft.com/Mobile/WebUserControl" %>
3 <P>
4 <mobile:StyleSheet id="StyleSheet1" runat="server" ReferencePath="mwucStyleSheet.ascx">
5 <mobile:Style Name="Link">
6 <DeviceSpecific>
7 <Choice Filter="isHTML32" Xmlns="http://schemas.microsoft.com/mobile/html32template"></Choice>
8 </DeviceSpecific>
9 </mobile:Style>
10 <mobile:Style Name="Textbox"></mobile:Style>
11 <mobile:Style Name="Button"></mobile:Style>
12 <mobile:Style ForeColor="Green" Name="Label"></mobile:Style>
13 <mobile:Style ForeColor="Green" Name="Label2"></mobile:Style>
14 </mobile:StyleSheet>
15 </P>- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, September 5, 2006 12:52 AM -
User-375488743 posted
Hi jpsaravanan,
the problem is solved. Thank you very much for your help.
It has been an stupid error made by me. Sometimes, the easyest issues are the most difficult to detect.
Thank you again.
Tuesday, September 5, 2006 11:22 AM