AW: RE: Bizarre TreeView Control Error
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngwebcontrols' list.


Markus
hey scott,

i'm doing it the same way like you: streaming the XML code directly to the
treeview using an aspx file.

please ensure that u only write the XML code via the HttpResponse object of
ASP.NET out of ur aspx page.
there mustn't be any other header or html tags in the Output stream.

perhaps this will solve ur problem!

greetinx from germany

markus

-----Ursprungliche Nachricht-----
Von: Scott Sargent [mailto:Click here to reveal e-mail address]
Gesendet: Montag, 6. Mai 2002 18:05
An: aspngwebcontrols
Betreff: [aspngwebcontrols] RE: Bizarre TreeView Control Error

Here's my source code:

<SOURCE_CODE>

<%@ Register TagPrefix="iewc" Namespace="Microsoft.Web.UI.WebControls"
Assembly="Microsoft.Web.UI.WebControls, Version=1.0.2.226, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.Web.UI.WebControls" %>
<%@ Page language="C#" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
    <HEAD>
        <title>IETreeView</title>
        <meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
        <meta content="C#" name="CODE_LANGUAGE">
        <meta content="JavaScript" name="vs_defaultClientScript">
        <meta content="http://schemas.microsoft.com/intellisense/ie5";
name="vs_targetSchema">
        <link rel="stylesheet" href="/style/aspx_master.css" type="text/css">
    </HEAD>
    <body MS_POSITIONING="GridLayout" bgcolor="navy">
        <font face="Verdana" color="white">
            <form id="IETreeView" method="post" runat="server">
                 
                <iewc:TreeView id="TreeView1"
DEFAULTSTYLE="font-family:verdana;color:white;" runat="server"
TreeNodeSrc="xslvoodoo.aspx" />
            </form>
        </font>
    </body>
</HTML>

</SOURCE_CODE>

The odd thing that I'm finding is that if i go to the xml page directly
(xslvoodo.aspx) i can see the xml it renders nicely and appears to be
correct. I can then save that off in a separate file and pass that filename
to the ie treeview control and poof it works. But it won't work if i pull
it from the aspx page. I've got the content type and character set on the
aspx page. Any ideas?

here's the xml

<?xml version="1.0" encoding="utf-8" ?>
<TREENODES>
<TREENODE Text="Knowledgebase"
NavigateUrl="/protected/nav/router.aspx?ItemId=1015">
<TREENODE Text="User Journal Tool"
NavigateUrl="/protected/nav/router.aspx?ItemId=1019">
<TREENODE Text="User Journal Tools"
NavigateUrl="/protected/nav/router.aspx?ItemId=1034">
</TREENODE>
<TREENODE Text="User Journal Pages"
NavigateUrl="/protected/nav/router.aspx?ItemId=1035">
<TREENODE Text="codeboy"
NavigateUrl="/protected/nav/router.aspx?ItemId=1023">
</TREENODE>
<TREENODE Text="athena"
NavigateUrl="/protected/nav/router.aspx?ItemId=1025">
</TREENODE>
<TREENODE Text="codemonkey"
NavigateUrl="/protected/nav/router.aspx?ItemId=1032">
</TREENODE>
<TREENODE Text="sqlfish"
NavigateUrl="/protected/nav/router.aspx?ItemId=1033">
</TREENODE>
<TREENODE Text="jdixon"
NavigateUrl="/protected/nav/router.aspx?ItemId=1038">
</TREENODE>
<TREENODE Text="mwittman"
NavigateUrl="/protected/nav/router.aspx?ItemId=1039">
</TREENODE>
<TREENODE Text="ssmagic"
NavigateUrl="/protected/nav/router.aspx?ItemId=1040">
</TREENODE>
</TREENODE>
</TREENODE>
<TREENODE Text="Technology"
NavigateUrl="/protected/nav/router.aspx?ItemId=1036">
<TREENODE Text="ASP.NET "
NavigateUrl="/protected/nav/router.aspx?ItemId=1016">
</TREENODE>
<TREENODE Text=".NET"
NavigateUrl="/protected/nav/router.aspx?ItemId=1017">
</TREENODE>
<TREENODE Text="SSMAGIC.COM"
NavigateUrl="/protected/nav/router.aspx?ItemId=1018">
</TREENODE>
</TREENODE>
<TREENODE Text="Life & Liesure"
NavigateUrl="/protected/nav/router.aspx?ItemId=1037">
</TREENODE>
</TREENODE>
</TREENODES>

[Original message clipped]

| [aspngwebcontrols] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngwebcontrols.asp = JOIN/QUIT

Reply to this message...
 
    
Scott Sargent
Ok, i'm trying another route, instead of using the asp:xml control I'm just
doing everything from the response stream as you reccomended.

one wierd thing that i just noticed, If I browse directly to the page
(xslvoodo.aspx) that contains the xml it shows it to me in perfect
formatting, no errors. If i Refresh the page, I get a 'QUOTE' error, if i
Refresh again it pops me out of forms authentication and my login page pops
up. I've got to believe whatever is causing the page to freak out on that
second reload is also causing the webcontrol to go nuts. Any Ideas? The
oddest part about this is the xml is hard coded, its pulling from a static
file and then dynamically applying the xsl which is also static. At some
point in the future i hope to have it a bit more dynamic but its not there
yet.

Here's the code for the page that generates the xml (xslvoodoo.aspx )

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml;
using System.Xml.Xsl;
namespace ssmagic.com.__protected.Nav
{
    /// <summary>
    /// Summary description for XSLVoodoo.
    /// </summary>
    public class XSLVoodoo : System.Web.UI.Page
    {
        private void Page_Load(object sender, System.EventArgs e)
        {
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.ContentType = "text/xml";

            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(Server.MapPath("itemtree.xml"));
            XslTransform xmltrans = new XslTransform();

            xmltrans.Load(Server.MapPath("testxsldyn.xsl"));

            xmltrans.Transform(xmlDoc.CreateNavigator(),null,Response.OutputStream);

        }

        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.Load += new System.EventHandler(this.Page_Load);
        }
        #endregion
    }
}

Which builds (some of the time apparently) this XML (the - were from IE)
<?xml version="1.0" encoding="utf-8" ?>
- <TREENODES>
- <TREENODE Text="Knowledgebase"
NavigateUrl="/protected/nav/router.aspx?ItemId=1015">
- <TREENODE Text="User Journal Tool"
NavigateUrl="/protected/nav/router.aspx?ItemId=1019">
<TREENODE Text="User Journal Tools"
NavigateUrl="/protected/nav/router.aspx?ItemId=1034" />
- <TREENODE Text="User Journal Pages"
NavigateUrl="/protected/nav/router.aspx?ItemId=1035">
<TREENODE Text="codeboy"
NavigateUrl="/protected/nav/router.aspx?ItemId=1023" />
<TREENODE Text="athena"
NavigateUrl="/protected/nav/router.aspx?ItemId=1025" />
<TREENODE Text="codemonkey"
NavigateUrl="/protected/nav/router.aspx?ItemId=1032" />
<TREENODE Text="sqlfish"
NavigateUrl="/protected/nav/router.aspx?ItemId=1033" />
<TREENODE Text="jdixon@ssmagic"
NavigateUrl="/protected/nav/router.aspx?ItemId=1038" />
<TREENODE Text="mwittman"
NavigateUrl="/protected/nav/router.aspx?ItemId=1039" />
<TREENODE Text="ssmagic"
NavigateUrl="/protected/nav/router.aspx?ItemId=1040" />
</TREENODE>
</TREENODE>
- <TREENODE Text="Technology"
NavigateUrl="/protected/nav/router.aspx?ItemId=1036">
<TREENODE Text="ASP.NET"
NavigateUrl="/protected/nav/router.aspx?ItemId=1016" />
<TREENODE Text=".NET" NavigateUrl="/protected/nav/router.aspx?ItemId=1017"
/>
<TREENODE Text="SSMAGIC.COM"
NavigateUrl="/protected/nav/router.aspx?ItemId=1018" />
</TREENODE>
<TREENODE Text="Life & Liesure"
NavigateUrl="/protected/nav/router.aspx?ItemId=1037" />
</TREENODE>
</TREENODES>

[Original message clipped]

Reply to this message...
 
 
System.EventArgs
System.EventHandler
System.Text.Encoding
System.Web.HttpResponse
System.Web.UI.Control
System.Web.UI.Page
System.Windows.Forms.TreeView
System.Xml.XmlDocument
System.Xml.XmlException
System.Xml.XmlReader
System.Xml.XmlTextReader
System.Xml.Xsl.XslTransform




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com