Treeview control/ dynamic data binding problem
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngwebcontrols' list.


Vivarelli, John
I'm stuck on getting the Treeview control to bind with dynamically =
generated data from SQL Server.
I've run out of ideas.
I would appreciate any help.

John

I get the error:
There is invalid data at the root level. Line 1, position 1.=20
Here is a code snippet:

        <form id=3D"Form1" method=3D"post" runat=3D"server">
            <mytree:treeview id=3D"Treeview1" runat=3D"server" =
TreeNodeSrc=3D"http://eosdwdev/ods?sql=3Dselect+id+from+dw_control+for+xm=
l+auto,+elements" =
TreeNodeXsltSrc=3D"http://eosdwdev/manage/TestDb_sql4.xsl"; =
ChildType=3D"Folder">
            </mytree:treeview>
        </form>

Note that I originally tried using a stored procedure and got the same =
problem, so I thought I would simplify things by using straight SQL.

If I execute the sql directly from my browser, the browser renders the =
result ok.
If I save the output to an XML file (content as follows)
<dw_control><id>1</id></dw_control>
and then replace the value of TreeNodeSrc to be =
TreeNodeSrc=3D"http://eosdwdev/manage/TestDb_sql4.xml"; such that my code =
snippet now reads:
        <form id=3D"Form1" method=3D"post" runat=3D"server">
            <mytree:treeview id=3D"Treeview1" runat=3D"server" =
TreeNodeSrc=3D"http://eosdwdev/manage/TestDb_sql4.xml"; =
TreeNodeXsltSrc=3D"http://eosdwdev/manage/TestDb_sql4.xsl"; >
            </mytree:treeview>
        </form>
IT WORKS OK, ie my treeview control is correctly bound.
Having noted previous correspondence regarding similar problems, I have =
fiddled around with various permissions, without success.

Note: my XSL reads:
<?xml version=3D"1.0" encoding=3D"UTF-8" ?>
<xsl:stylesheet version=3D"1.0" =
xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform";>
<xsl:output omit-xml-declaration=3D"yes">
</xsl:output>
<xsl:template match=3D"/">
<TREENODES>
<xsl:for-each select=3D"dw_control/id">
        <xsl:element name=3D"TreeNode">
            <xsl:attribute name=3D"Text" >
                <xsl:value-of select=3D"."/>
            </xsl:attribute>
        </xsl:element>
</xsl:for-each>
</TREENODES>
</xsl:template>
</xsl:stylesheet>

Reply to this message...
 
    
Shannon Cornish
Hi John,
Do you have any security on the website (forms/windows etc)?

Shannon,

-----Original Message-----
From: Vivarelli, John [mailto:Click here to reveal e-mail address]=20
Sent: Monday, 29 April 2002 3:37 PM
To: aspngwebcontrols
Subject: [aspngwebcontrols] Treeview control/ dynamic data binding
problem

I'm stuck on getting the Treeview control to bind with dynamically
generated data from SQL Server. I've run out of ideas. I would
appreciate any help.

John

I get the error:
There is invalid data at the root level. Line 1, position 1.=20
Here is a code snippet:

        <form id=3D"Form1" method=3D"post" runat=3D"server">
            <mytree:treeview id=3D"Treeview1" runat=3D"server"
TreeNodeSrc=3D"http://eosdwdev/ods?sql=3Dselect+id+from+dw_control+for+xm=
l+a
uto,+elements" =
TreeNodeXsltSrc=3D"http://eosdwdev/manage/TestDb_sql4.xsl";
ChildType=3D"Folder">
            </mytree:treeview>
        </form>

Note that I originally tried using a stored procedure and got the same
problem, so I thought I would simplify things by using straight SQL.

If I execute the sql directly from my browser, the browser renders the
result ok. If I save the output to an XML file (content as follows)
<dw_control><id>1</id></dw_control>
and then replace the value of TreeNodeSrc to be
TreeNodeSrc=3D"http://eosdwdev/manage/TestDb_sql4.xml"; such that my code
snippet now reads:
        <form id=3D"Form1" method=3D"post" runat=3D"server">
            <mytree:treeview id=3D"Treeview1" runat=3D"server"
TreeNodeSrc=3D"http://eosdwdev/manage/TestDb_sql4.xml";
TreeNodeXsltSrc=3D"http://eosdwdev/manage/TestDb_sql4.xsl"; >
            </mytree:treeview>
        </form>
IT WORKS OK, ie my treeview control is correctly bound.
Having noted previous correspondence regarding similar problems, I have
fiddled around with various permissions, without success.

Note: my XSL reads:
<?xml version=3D"1.0" encoding=3D"UTF-8" ?>
<xsl:stylesheet version=3D"1.0"
xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform";>
<xsl:output omit-xml-declaration=3D"yes">
</xsl:output>
<xsl:template match=3D"/">
<TREENODES>
<xsl:for-each select=3D"dw_control/id">
        <xsl:element name=3D"TreeNode">
            <xsl:attribute name=3D"Text" >
                <xsl:value-of select=3D"."/>
            </xsl:attribute>
        </xsl:element>
</xsl:for-each>
</TREENODES>
</xsl:template>
</xsl:stylesheet>

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

Reply to this message...
 
    
Vivarelli, John
Hi Shannon,

In web.config I have:
<authentication mode=3D"Windows" />=20

In IIS Virtual Directory Management for SQL Server,
    security used is 'Windows Integrated Authentication'

In IIS,
    the web site containing the .aspx page, in properties/Directory =
security/authentication methods, uses:
        Anonymous access and Integrated Windows Authentication

Is this sort of what you wanted to know?

Thanks

John

-----Original Message-----
From: Shannon Cornish [mailto:Click here to reveal e-mail address]
Sent: Monday, 29 April 2002 4:23 PM
To: aspngwebcontrols
Subject: [aspngwebcontrols] RE: Treeview control/ dynamic data binding
problem

Hi John,
Do you have any security on the website (forms/windows etc)?

Shannon,

-----Original Message-----
From: Vivarelli, John [mailto:Click here to reveal e-mail address]=20
Sent: Monday, 29 April 2002 3:37 PM
To: aspngwebcontrols
Subject: [aspngwebcontrols] Treeview control/ dynamic data binding
problem

I'm stuck on getting the Treeview control to bind with dynamically
generated data from SQL Server. I've run out of ideas. I would
appreciate any help.

John

I get the error:
There is invalid data at the root level. Line 1, position 1.=20
Here is a code snippet:

        <form id=3D"Form1" method=3D"post" runat=3D"server">
            <mytree:treeview id=3D"Treeview1" runat=3D"server"
TreeNodeSrc=3D"http://eosdwdev/ods?sql=3Dselect+id+from+dw_control+for+xm=
l+a
uto,+elements" =
TreeNodeXsltSrc=3D"http://eosdwdev/manage/TestDb_sql4.xsl";
ChildType=3D"Folder">
            </mytree:treeview>
        </form>

Note that I originally tried using a stored procedure and got the same
problem, so I thought I would simplify things by using straight SQL.

If I execute the sql directly from my browser, the browser renders the
result ok. If I save the output to an XML file (content as follows)
<dw_control><id>1</id></dw_control>
and then replace the value of TreeNodeSrc to be
TreeNodeSrc=3D"http://eosdwdev/manage/TestDb_sql4.xml"; such that my code
snippet now reads:
        <form id=3D"Form1" method=3D"post" runat=3D"server">
            <mytree:treeview id=3D"Treeview1" runat=3D"server"
TreeNodeSrc=3D"http://eosdwdev/manage/TestDb_sql4.xml";
TreeNodeXsltSrc=3D"http://eosdwdev/manage/TestDb_sql4.xsl"; >
            </mytree:treeview>
        </form>
IT WORKS OK, ie my treeview control is correctly bound.
Having noted previous correspondence regarding similar problems, I have
fiddled around with various permissions, without success.

Note: my XSL reads:
<?xml version=3D"1.0" encoding=3D"UTF-8" ?>
<xsl:stylesheet version=3D"1.0"
xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform";>
<xsl:output omit-xml-declaration=3D"yes">
</xsl:output>
<xsl:template match=3D"/">
<TREENODES>
<xsl:for-each select=3D"dw_control/id">
        <xsl:element name=3D"TreeNode">
            <xsl:attribute name=3D"Text" >
                <xsl:value-of select=3D"."/>
            </xsl:attribute>
        </xsl:element>
</xsl:for-each>
</TREENODES>
</xsl:template>
</xsl:stylesheet>

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

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

Reply to this message...
 
    
James Avery
Exactly what we want to know. :) Try running sql from an anonymous
account or remotely to see if it is permissions, when you run the page
it will use your permissions which are most likely administrator. When
the system runs it will run as the aspnet account.

Here is your input:
TreeNodeSrc="http://eosdwdev/ods?sql=select+id+from+dw_control+for+xml+a
uto,+elements"

Should that "," be in there?

-----Original Message-----
From: Vivarelli, John [mailto:Click here to reveal e-mail address]
Sent: Monday, April 29, 2002 2:49 AM
To: aspngwebcontrols
Subject: [aspngwebcontrols] RE: Treeview control/ dynamic data binding
problem

Hi Shannon,

In web.config I have:
<authentication mode="Windows" />

In IIS Virtual Directory Management for SQL Server,
    security used is 'Windows Integrated Authentication'

In IIS,
    the web site containing the .aspx page, in properties/Directory
security/authentication methods, uses:
        Anonymous access and Integrated Windows Authentication

Is this sort of what you wanted to know?

Thanks

John

-----Original Message-----
From: Shannon Cornish [mailto:Click here to reveal e-mail address]
Sent: Monday, 29 April 2002 4:23 PM
To: aspngwebcontrols
Subject: [aspngwebcontrols] RE: Treeview control/ dynamic data binding
problem

Hi John,
Do you have any security on the website (forms/windows etc)?

Shannon,

-----Original Message-----
From: Vivarelli, John [mailto:Click here to reveal e-mail address]
Sent: Monday, 29 April 2002 3:37 PM
To: aspngwebcontrols
Subject: [aspngwebcontrols] Treeview control/ dynamic data binding
problem

I'm stuck on getting the Treeview control to bind with dynamically
generated data from SQL Server. I've run out of ideas. I would
appreciate any help.

John

I get the error:
There is invalid data at the root level. Line 1, position 1.
Here is a code snippet:

        <form id="Form1" method="post" runat="server">
            <mytree:treeview id="Treeview1" runat="server"
TreeNodeSrc="http://eosdwdev/ods?sql=select+id+from+dw_control+for+xml+a
uto,+elements" TreeNodeXsltSrc="http://eosdwdev/manage/TestDb_sql4.xsl";
ChildType="Folder">
            </mytree:treeview>
        </form>

Note that I originally tried using a stored procedure and got the same
problem, so I thought I would simplify things by using straight SQL.

If I execute the sql directly from my browser, the browser renders the
result ok. If I save the output to an XML file (content as follows)
<dw_control><id>1</id></dw_control>
and then replace the value of TreeNodeSrc to be
TreeNodeSrc="http://eosdwdev/manage/TestDb_sql4.xml"; such that my code
snippet now reads:
        <form id="Form1" method="post" runat="server">
            <mytree:treeview id="Treeview1" runat="server"
TreeNodeSrc="http://eosdwdev/manage/TestDb_sql4.xml";
TreeNodeXsltSrc="http://eosdwdev/manage/TestDb_sql4.xsl"; >
            </mytree:treeview>
        </form>
IT WORKS OK, ie my treeview control is correctly bound.
Having noted previous correspondence regarding similar problems, I have
fiddled around with various permissions, without success.

Note: my XSL reads:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output omit-xml-declaration="yes">
</xsl:output>
<xsl:template match="/">
<TREENODES>
<xsl:for-each select="dw_control/id">
        <xsl:element name="TreeNode">
            <xsl:attribute name="Text" >
                <xsl:value-of select="."/>
            </xsl:attribute>
        </xsl:element>
</xsl:for-each>
</TREENODES>
</xsl:template>
</xsl:stylesheet>

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

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

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

Reply to this message...
 
    
Oleg Boutorine
Much easier to use TreeView from
http://www.ASPTreeView.com

Take a look. It doesn't reload each time node is collapsed or expanded. You
can change styles with one property.

I'm stuck on getting the Treeview control to bind with dynamically generated
data from SQL Server.
I've run out of ideas.
I would appreciate any help.

John

I get the error:
There is invalid data at the root level. Line 1, position 1.
Here is a code snippet:

        <form id="Form1" method="post" runat="server">
            <mytree:treeview id="Treeview1" runat="server"
TreeNodeSrc="http://eosdwdev/ods?sql=select+id+from+dw_control+for+xml+auto,+elements"
TreeNodeXsltSrc="http://eosdwdev/manage/TestDb_sql4.xsl";
ChildType="Folder">
            </mytree:treeview>
        </form>

Note that I originally tried using a stored procedure and got the same
problem, so I thought I would simplify things by using straight SQL.

If I execute the sql directly from my browser, the browser renders the
result ok.
If I save the output to an XML file (content as follows)
<dw_control><id>1</id></dw_control>
and then replace the value of TreeNodeSrc to be
TreeNodeSrc="http://eosdwdev/manage/TestDb_sql4.xml"; such that my code
snippet now reads:
        <form id="Form1" method="post" runat="server">
            <mytree:treeview id="Treeview1" runat="server"
TreeNodeSrc="http://eosdwdev/manage/TestDb_sql4.xml";
TreeNodeXsltSrc="http://eosdwdev/manage/TestDb_sql4.xsl"; >
            </mytree:treeview>
        </form>
IT WORKS OK, ie my treeview control is correctly bound.
Having noted previous correspondence regarding similar problems, I have
fiddled around with various permissions, without success.

Note: my XSL reads:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output omit-xml-declaration="yes">
</xsl:output>
<xsl:template match="/">
<TREENODES>
<xsl:for-each select="dw_control/id">
        <xsl:element name="TreeNode">
            <xsl:attribute name="Text" >
                <xsl:value-of select="."/>
            </xsl:attribute>
        </xsl:element>
</xsl:for-each>
</TREENODES>
</xsl:template>
</xsl:stylesheet>

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

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx

Reply to this message...
 
    
Shannon Cornish
Hi John,

In your web.config, you will need to add

    <location path=3D"treedata.aspx">
        <system.web>
            <authorization>
                <allow users=3D"*" />
            </authorization>=20
        </system.web>
    </location>

Where, treedata.aspx is the aspx file that builds the XML.
The treeview does not 'forward' your username/password when requesting
the XML file.

So when you try to get the data, it sends back an access denied error
and the treeview will take it as this is the XML file you wish to use,
hence your getting invalid XML only when you have your treeview set to
this file, and it will work fine when you use your browser to visit
'treedata.aspx'

HTH,
Shannon,

-----Original Message-----
From: Vivarelli, John [mailto:Click here to reveal e-mail address]=20
Sent: Monday, 29 April 2002 4:49 PM
To: aspngwebcontrols
Subject: [aspngwebcontrols] RE: Treeview control/ dynamic data binding
problem

Hi Shannon,

In web.config I have:
<authentication mode=3D"Windows" />=20

In IIS Virtual Directory Management for SQL Server,
    security used is 'Windows Integrated Authentication'

In IIS,
    the web site containing the .aspx page, in properties/Directory
security/authentication methods, uses:
        Anonymous access and Integrated Windows Authentication

Is this sort of what you wanted to know?

Thanks

John

-----Original Message-----
From: Shannon Cornish [mailto:Click here to reveal e-mail address]
Sent: Monday, 29 April 2002 4:23 PM
To: aspngwebcontrols
Subject: [aspngwebcontrols] RE: Treeview control/ dynamic data binding
problem

Hi John,
Do you have any security on the website (forms/windows etc)?

Shannon,

-----Original Message-----
From: Vivarelli, John [mailto:Click here to reveal e-mail address]=20
Sent: Monday, 29 April 2002 3:37 PM
To: aspngwebcontrols
Subject: [aspngwebcontrols] Treeview control/ dynamic data binding
problem

I'm stuck on getting the Treeview control to bind with dynamically
generated data from SQL Server. I've run out of ideas. I would
appreciate any help.

John

I get the error:
There is invalid data at the root level. Line 1, position 1.=20
Here is a code snippet:

        <form id=3D"Form1" method=3D"post" runat=3D"server">
            <mytree:treeview id=3D"Treeview1" runat=3D"server"
TreeNodeSrc=3D"http://eosdwdev/ods?sql=3Dselect+id+from+dw_control+for+xm=
l+a
uto,+elements" =
TreeNodeXsltSrc=3D"http://eosdwdev/manage/TestDb_sql4.xsl";
ChildType=3D"Folder">
            </mytree:treeview>
        </form>

Note that I originally tried using a stored procedure and got the same
problem, so I thought I would simplify things by using straight SQL.

If I execute the sql directly from my browser, the browser renders the
result ok. If I save the output to an XML file (content as follows)
<dw_control><id>1</id></dw_control>
and then replace the value of TreeNodeSrc to be
TreeNodeSrc=3D"http://eosdwdev/manage/TestDb_sql4.xml"; such that my code
snippet now reads:
        <form id=3D"Form1" method=3D"post" runat=3D"server">
            <mytree:treeview id=3D"Treeview1" runat=3D"server"
TreeNodeSrc=3D"http://eosdwdev/manage/TestDb_sql4.xml";
TreeNodeXsltSrc=3D"http://eosdwdev/manage/TestDb_sql4.xsl"; >
            </mytree:treeview>
        </form>
IT WORKS OK, ie my treeview control is correctly bound.
Having noted previous correspondence regarding similar problems, I have
fiddled around with various permissions, without success.

Note: my XSL reads:
<?xml version=3D"1.0" encoding=3D"UTF-8" ?>
<xsl:stylesheet version=3D"1.0"
xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform";>
<xsl:output omit-xml-declaration=3D"yes">
</xsl:output>
<xsl:template match=3D"/">
<TREENODES>
<xsl:for-each select=3D"dw_control/id">
        <xsl:element name=3D"TreeNode">
            <xsl:attribute name=3D"Text" >
                <xsl:value-of select=3D"."/>
            </xsl:attribute>
        </xsl:element>
</xsl:for-each>
</TREENODES>
</xsl:template>
</xsl:stylesheet>

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

| [aspngwebcontrols] member Click here to reveal e-mail address =3D YOUR =

| ID http://www.asplists.com/asplists/aspngwebcontrols.asp =3D JOIN/QUIT

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

Reply to this message...
 
    
Vivarelli, John
Hi Shannon,

I've still got the same problem - maybe I'm not placing the supplied =
changes to web.config in the right place. I've tried various places.

Here is my web.config file - it's the standard one except for =
CustomErrors which is set to Off.

<?xml version=3D"1.0" encoding=3D"utf-8" ?>
<configuration>
=20
<system.web>

<!-- DYNAMIC DEBUG COMPILATION
Set compilation debug=3D"true" to insert debugging symbols =
(.pdb information)
into the compiled page. Because this creates a larger file =
that executes
more slowly, you should set this value to true only when =
debugging and to
false at all other times. For more information, refer to the =
documentation about
debugging ASP.NET files.
-->
<compilation defaultLanguage=3D"vb" debug=3D"true" />

<!-- CUSTOM ERROR MESSAGES
Set customErrors mode=3D"On" or "RemoteOnly" to enable custom =
error messages, "Off" to disable.=20
Add <error> tags for each of the errors you want to handle.
-->
<customErrors mode=3D"Off" />

<!-- AUTHENTICATION=20
This section sets the authentication policies of the =
application. Possible modes are "Windows",=20
"Forms", "Passport" and "None"
-->
<authentication mode=3D"Windows" />=20

<!-- AUTHORIZATION=20
This section sets the authorization policies of the =
application. You can allow or deny access
to application resources by user or role. Wildcards: "*" mean =
everyone, "?" means anonymous=20
(unauthenticated) users.
-->
<authorization>
<allow users=3D"*" /> <!-- Allow all users -->

<!-- <allow users=3D"[comma separated list of users]"
roles=3D"[comma separated list of roles]"/>
<deny users=3D"[comma separated list of users]"
roles=3D"[comma separated list of roles]"/>
-->
</authorization>

<!-- APPLICATION-LEVEL TRACE LOGGING
Application-level tracing enables trace log output for every =
page within an application.=20
Set trace enabled=3D"true" to enable application trace =
logging. If pageOutput=3D"true", the
trace information will be displayed at the bottom of each =
page. Otherwise, you can view the=20
application trace log by browsing the "trace.axd" page from =
your web application
root.=20
-->
<trace enabled=3D"false" requestLimit=3D"10" pageOutput=3D"false" =
traceMode=3D"SortByTime" localOnly=3D"true" />

<!-- SESSION STATE SETTINGS
By default ASP.NET uses cookies to identify which requests =
belong to a particular session.=20
If cookies are not available, a session can be tracked by =
adding a session identifier to the URL.=20
To disable cookies, set sessionState cookieless=3D"true".
-->
<sessionState=20
mode=3D"InProc"
stateConnectionString=3D"tcpip=3D127.0.0.1:42424"
sqlConnectionString=3D"data source=3D127.0.0.1;user =
id=3Dsa;password=3D"
cookieless=3D"false"=20
timeout=3D"20"=20
/>

<!-- GLOBALIZATION
This section sets the globalization settings of the =
application.=20
-->
<globalization requestEncoding=3D"utf-8" responseEncoding=3D"utf-8" =
/>

</system.web>
=20
</configuration>

Regards,
John

-----Original Message-----
From: Shannon Cornish [mailto:Click here to reveal e-mail address]
Sent: Monday, 29 April 2002 4:58 PM
To: aspngwebcontrols
Subject: [aspngwebcontrols] RE: Treeview control/ dynamic data binding
problem

Hi John,

In your web.config, you will need to add

    <location path=3D"treedata.aspx">
        <system.web>
            <authorization>
                <allow users=3D"*" />
            </authorization>=20
        </system.web>
    </location>

Where, treedata.aspx is the aspx file that builds the XML.
The treeview does not 'forward' your username/password when requesting
the XML file.

So when you try to get the data, it sends back an access denied error
and the treeview will take it as this is the XML file you wish to use,
hence your getting invalid XML only when you have your treeview set to
this file, and it will work fine when you use your browser to visit
'treedata.aspx'

HTH,
Shannon,

-----Original Message-----
From: Vivarelli, John [mailto:Click here to reveal e-mail address]=20
Sent: Monday, 29 April 2002 4:49 PM
To: aspngwebcontrols
Subject: [aspngwebcontrols] RE: Treeview control/ dynamic data binding
problem

Hi Shannon,

In web.config I have:
<authentication mode=3D"Windows" />=20

In IIS Virtual Directory Management for SQL Server,
    security used is 'Windows Integrated Authentication'

In IIS,
    the web site containing the .aspx page, in properties/Directory
security/authentication methods, uses:
        Anonymous access and Integrated Windows Authentication

Is this sort of what you wanted to know?

Thanks

John

-----Original Message-----
From: Shannon Cornish [mailto:Click here to reveal e-mail address]
Sent: Monday, 29 April 2002 4:23 PM
To: aspngwebcontrols
Subject: [aspngwebcontrols] RE: Treeview control/ dynamic data binding
problem

Hi John,
Do you have any security on the website (forms/windows etc)?

Shannon,

-----Original Message-----
From: Vivarelli, John [mailto:Click here to reveal e-mail address]=20
Sent: Monday, 29 April 2002 3:37 PM
To: aspngwebcontrols
Subject: [aspngwebcontrols] Treeview control/ dynamic data binding
problem

I'm stuck on getting the Treeview control to bind with dynamically
generated data from SQL Server. I've run out of ideas. I would
appreciate any help.

John

I get the error:
There is invalid data at the root level. Line 1, position 1.=20
Here is a code snippet:

        <form id=3D"Form1" method=3D"post" runat=3D"server">
            <mytree:treeview id=3D"Treeview1" runat=3D"server"
TreeNodeSrc=3D"http://eosdwdev/ods?sql=3Dselect+id+from+dw_control+for+xm=
l+a
uto,+elements" =
TreeNodeXsltSrc=3D"http://eosdwdev/manage/TestDb_sql4.xsl";
ChildType=3D"Folder">
            </mytree:treeview>
        </form>

Note that I originally tried using a stored procedure and got the same
problem, so I thought I would simplify things by using straight SQL.

If I execute the sql directly from my browser, the browser renders the
result ok. If I save the output to an XML file (content as follows)
<dw_control><id>1</id></dw_control>
and then replace the value of TreeNodeSrc to be
TreeNodeSrc=3D"http://eosdwdev/manage/TestDb_sql4.xml"; such that my code
snippet now reads:
        <form id=3D"Form1" method=3D"post" runat=3D"server">
            <mytree:treeview id=3D"Treeview1" runat=3D"server"
TreeNodeSrc=3D"http://eosdwdev/manage/TestDb_sql4.xml";
TreeNodeXsltSrc=3D"http://eosdwdev/manage/TestDb_sql4.xsl"; >
            </mytree:treeview>
        </form>
IT WORKS OK, ie my treeview control is correctly bound.
Having noted previous correspondence regarding similar problems, I have
fiddled around with various permissions, without success.

Note: my XSL reads:
<?xml version=3D"1.0" encoding=3D"UTF-8" ?>
<xsl:stylesheet version=3D"1.0"
xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform";>
<xsl:output omit-xml-declaration=3D"yes">
</xsl:output>
<xsl:template match=3D"/">
<TREENODES>
<xsl:for-each select=3D"dw_control/id">
        <xsl:element name=3D"TreeNode">
            <xsl:attribute name=3D"Text" >
                <xsl:value-of select=3D"."/>
            </xsl:attribute>
        </xsl:element>
</xsl:for-each>
</TREENODES>
</xsl:template>
</xsl:stylesheet>

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

| [aspngwebcontrols] member Click here to reveal e-mail address =3D YOUR =

| ID http://www.asplists.com/asplists/aspngwebcontrols.asp =3D JOIN/QUIT

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

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

Reply to this message...
 
    
Derek Harding
I've noticed that this problem can occur if the server's Windows computer name or IP address does not match the server name or address in the request url. Specifically, I was running into this problem because our server was located on a private network behind a firewall. The server had been assigned a private network IP address (eg. 192.168.1.1) and I was accessing it across the internet using its public address. For some reason this causes problems for the TreeView control when it tries to load xml/xslt files (either the xml source document, the xslt transformation or the treenodetype definition file). If the IP address in the request URL does not match the server's idea of what it's IP or server name is, you end up getting the error message you are seeing. I was able to work around this problem by adding the server's Windows Computer Name to my hosts file, and associating this with its public IP address. This allowed me to use the server's Windows Computer Name in the request URL, which eliminates the error.

--------------------------------
From: Derek Harding
Reply to this message...
 
 
System.Windows.Forms.TreeNode
System.Windows.Forms.TreeView




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