473,406 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How to enter a variable in the treenodesrc of a treenode

Hi. I am trying to enter a variable in the treenodesrc of a treenode. I am
basically trying to send an ID variable into sql to return different records.
I've searched everywhere and cannot find the answer. I'd appreciate and help.
Thanks.

What I'm doing is creating a treeview with the structure as follows (this is
the expanded view):

- Item Status
- Item Status Details
- Item Status Details
- Item Status Details

It's very basic. "Item Status" is the static <treenode text=. Now the
treenodesrc is where I'm having my problem. I'm trying to send a dynamic
variable into sql in order to return the associated records ("Item Status
Details") using --
TreeNodeSrc="http://www.domain.com/sqlDataBaseName?sql=execute+StoredProcedu
reName+@variable=&variable". The variable comes to the page through a
querystring. Of course my code reflects my specifics. But I've set up
XMLSQL, and when I hard code the variable into the string it works perfectly.
The query works, my stored procedure returns the proper XML, and my TreeView
looks exactly how I want it to look. But when I try to put a dynamic variable
in I get a Parser Error and says "The literal string - and then my
treenodesrc string - was found. Literal strings are not allowed within this
control.

All that I'm trying to do is send a dynamic variable into that treenodesrc
string where that &variable is above.

Hopefully I've explained this well enough. Let me know.

Thanks.

Nov 19 '05 #1
3 1811
Hi markaelkins,

Welcome to ASPNET newsgroup.
From your description, you're using the IE WEbcontrols's TreeView control
and use some dynamically retrieved xmldata from sqlserver to bind the nodes
in TreeView. Currently you're wondering how to dynamically assign the
TreeNodeSrc for certain TreeNodes in the TreeView, yes?

Based on my research, for the IE TreeView control, in the aspx inline
template, we can not use
<% ...%> render expression(also not allowed for assigning value to normal
webserver control's property) or
<%# ...%> databinding expression to assign dynamic value to TreeNode's
property. However, we can use code in codebehind or help function to
assign the property on the TreeNode instance and call its DataBind() method
to populate the dynamic children. For example:

===============
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{

tvMain.Nodes[0].TreeNodeSrc = GetNodeSrcFromDataBase();
tvMain.Nodes[0].Databind();

}
}

The TreeView has provide some function like TreeView.GetNodeFromIndex which
help use find node instance
through Node hierarchy.

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| Thread-Topic: How to enter a variable in the treenodesrc of a treenode
| thread-index: AcW6AvT5x6w5gCYGTfWxLqsYXqsBLA==
| X-WBNR-Posting-Host: 67.79.167.182
| From: "=?Utf-8?B?bWFya2FlbGtpbnNAbmV3c2dyb3Vwcy5ub3NwYW0=?="
<ma*********@newsgroups.nospam>
| Subject: How to enter a variable in the treenodesrc of a treenode
| Date: Thu, 15 Sep 2005 07:37:11 -0700
| Lines: 34
| Message-ID: <2A**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:124805
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hi. I am trying to enter a variable in the treenodesrc of a treenode. I
am
| basically trying to send an ID variable into sql to return different
records.
| I've searched everywhere and cannot find the answer. I'd appreciate and
help.
| Thanks.
|
| What I'm doing is creating a treeview with the structure as follows (this
is
| the expanded view):
|
| - Item Status
| - Item Status Details
| - Item Status Details
| - Item Status Details
|
| It's very basic. "Item Status" is the static <treenode text=. Now the
| treenodesrc is where I'm having my problem. I'm trying to send a dynamic
| variable into sql in order to return the associated records ("Item Status
| Details") using --
|
TreeNodeSrc="http://www.domain.com/sqlDataBaseName?sql=execute+StoredProcedu
| reName+@variable=&variable". The variable comes to the page through a
| querystring. Of course my code reflects my specifics. But I've set up
| XMLSQL, and when I hard code the variable into the string it works
perfectly.
| The query works, my stored procedure returns the proper XML, and my
TreeView
| looks exactly how I want it to look. But when I try to put a dynamic
variable
| in I get a Parser Error and says "The literal string - and then my
| treenodesrc string - was found. Literal strings are not allowed within
this
| control.
|
| All that I'm trying to do is send a dynamic variable into that
treenodesrc
| string where that &variable is above.
|
| Hopefully I've explained this well enough. Let me know.
|
| Thanks.
|
|

Nov 19 '05 #2
Thanks Steven.

You definitely understand my problem. What is the
"GetNodeSrcFromDataBase()". Is that a command, a function I need to build...?
Also, it's not a big deal because I can translate fairly well, but I write in
VB.

I really appreciate the help. In my research and simply trying to develop
this, I've come across maybe a handful of articles even dealing with
treenodes, and even fewer retrieving records from a database.

Thank you,

Mark

"Steven Cheng[MSFT]" wrote:
Hi markaelkins,

Welcome to ASPNET newsgroup.
From your description, you're using the IE WEbcontrols's TreeView control
and use some dynamically retrieved xmldata from sqlserver to bind the nodes
in TreeView. Currently you're wondering how to dynamically assign the
TreeNodeSrc for certain TreeNodes in the TreeView, yes?

Based on my research, for the IE TreeView control, in the aspx inline
template, we can not use
<% ...%> render expression(also not allowed for assigning value to normal
webserver control's property) or
<%# ...%> databinding expression to assign dynamic value to TreeNode's
property. However, we can use code in codebehind or help function to
assign the property on the TreeNode instance and call its DataBind() method
to populate the dynamic children. For example:

===============
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{

tvMain.Nodes[0].TreeNodeSrc = GetNodeSrcFromDataBase();
tvMain.Nodes[0].Databind();

}
}

The TreeView has provide some function like TreeView.GetNodeFromIndex which
help use find node instance
through Node hierarchy.

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| Thread-Topic: How to enter a variable in the treenodesrc of a treenode
| thread-index: AcW6AvT5x6w5gCYGTfWxLqsYXqsBLA==
| X-WBNR-Posting-Host: 67.79.167.182
| From: "=?Utf-8?B?bWFya2FlbGtpbnNAbmV3c2dyb3Vwcy5ub3NwYW0=?="
<ma*********@newsgroups.nospam>
| Subject: How to enter a variable in the treenodesrc of a treenode
| Date: Thu, 15 Sep 2005 07:37:11 -0700
| Lines: 34
| Message-ID: <2A**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:124805
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hi. I am trying to enter a variable in the treenodesrc of a treenode. I
am
| basically trying to send an ID variable into sql to return different
records.
| I've searched everywhere and cannot find the answer. I'd appreciate and
help.
| Thanks.
|
| What I'm doing is creating a treeview with the structure as follows (this
is
| the expanded view):
|
| - Item Status
| - Item Status Details
| - Item Status Details
| - Item Status Details
|
| It's very basic. "Item Status" is the static <treenode text=. Now the
| treenodesrc is where I'm having my problem. I'm trying to send a dynamic
| variable into sql in order to return the associated records ("Item Status
| Details") using --
|
TreeNodeSrc="http://www.domain.com/sqlDataBaseName?sql=execute+StoredProcedu
| reName+@variable=&variable". The variable comes to the page through a
| querystring. Of course my code reflects my specifics. But I've set up
| XMLSQL, and when I hard code the variable into the string it works
perfectly.
| The query works, my stored procedure returns the proper XML, and my
TreeView
| looks exactly how I want it to look. But when I try to put a dynamic
variable
| in I get a Parser Error and says "The literal string - and then my
| treenodesrc string - was found. Literal strings are not allowed within
this
| control.
|
| All that I'm trying to do is send a dynamic variable into that
treenodesrc
| string where that &variable is above.
|
| Hopefully I've explained this well enough. Let me know.
|
| Thanks.
|
|

Nov 19 '05 #3
Hi Mark,

Thanks for your followup.
As for the "GetNodeSrcFromDataBase()", it's just a dummy function I used to
get a url string(for the TreeNode's TreeNodeSrc ....). So you can write
your own helper function to retrieve the TreeNode src url string from
database or other storage....

Anyway, currently we could only programmatically assign TreeNodeSrc
property through code behind code. In addition, since the IE webcontrols
are legacy components which are no longer supported, we'd also recommend
you consider migrating to the new Naviagation controls in the ASP.NET
2.0(whidbey).

Thanks & Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Thread-Topic: How to enter a variable in the treenodesrc of a treenode
| thread-index: AcW6xxIb4YGbiE36Rh2knHiAN684ew==
| X-WBNR-Posting-Host: 24.227.52.74
| From: "=?Utf-8?B?bWFya2FlbGtpbnNAbmV3c2dyb3Vwcy5ub3NwYW0=?="
<ma*********@newsgroups.nospam>
| References: <2A**********************************@microsoft.co m>
<SZ*************@TK2MSFTNGXA01.phx.gbl>
| Subject: RE: How to enter a variable in the treenodesrc of a treenode
| Date: Fri, 16 Sep 2005 07:01:01 -0700
| Lines: 134
| Message-ID: <94**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:125128
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks Steven.
|
| You definitely understand my problem. What is the
| "GetNodeSrcFromDataBase()". Is that a command, a function I need to
build...?
| Also, it's not a big deal because I can translate fairly well, but I
write in
| VB.
|
| I really appreciate the help. In my research and simply trying to develop
| this, I've come across maybe a handful of articles even dealing with
| treenodes, and even fewer retrieving records from a database.
|
| Thank you,
|
| Mark
|
| "Steven Cheng[MSFT]" wrote:
|
| > Hi markaelkins,
| >
| > Welcome to ASPNET newsgroup.
| > From your description, you're using the IE WEbcontrols's TreeView
control
| > and use some dynamically retrieved xmldata from sqlserver to bind the
nodes
| > in TreeView. Currently you're wondering how to dynamically assign the
| > TreeNodeSrc for certain TreeNodes in the TreeView, yes?
| >
| > Based on my research, for the IE TreeView control, in the aspx inline
| > template, we can not use
| > <% ...%> render expression(also not allowed for assigning value to
normal
| > webserver control's property) or
| > <%# ...%> databinding expression to assign dynamic value to TreeNode's
| > property. However, we can use code in codebehind or help function to
| > assign the property on the TreeNode instance and call its DataBind()
method
| > to populate the dynamic children. For example:
| >
| > ===============
| > private void Page_Load(object sender, System.EventArgs e)
| > {
| > if(!IsPostBack)
| > {
| >
| > tvMain.Nodes[0].TreeNodeSrc = GetNodeSrcFromDataBase();
| > tvMain.Nodes[0].Databind();
| >
| > }
| > }
| >
| > The TreeView has provide some function like TreeView.GetNodeFromIndex
which
| > help use find node instance
| > through Node hierarchy.
| >
| > Hope helps. Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| > --------------------
| > | Thread-Topic: How to enter a variable in the treenodesrc of a treenode
| > | thread-index: AcW6AvT5x6w5gCYGTfWxLqsYXqsBLA==
| > | X-WBNR-Posting-Host: 67.79.167.182
| > | From: "=?Utf-8?B?bWFya2FlbGtpbnNAbmV3c2dyb3Vwcy5ub3NwYW0=?="
| > <ma*********@newsgroups.nospam>
| > | Subject: How to enter a variable in the treenodesrc of a treenode
| > | Date: Thu, 15 Sep 2005 07:37:11 -0700
| > | Lines: 34
| > | Message-ID: <2A**********************************@microsoft.co m>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="Utf-8"
| > | Content-Transfer-Encoding: 7bit
| > | X-Newsreader: Microsoft CDO for Windows 2000
| > | Content-Class: urn:content-classes:message
| > | Importance: normal
| > | Priority: normal
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:124805
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | Hi. I am trying to enter a variable in the treenodesrc of a treenode.
I
| > am
| > | basically trying to send an ID variable into sql to return different
| > records.
| > | I've searched everywhere and cannot find the answer. I'd appreciate
and
| > help.
| > | Thanks.
| > |
| > | What I'm doing is creating a treeview with the structure as follows
(this
| > is
| > | the expanded view):
| > |
| > | - Item Status
| > | - Item Status Details
| > | - Item Status Details
| > | - Item Status Details
| > |
| > | It's very basic. "Item Status" is the static <treenode text=. Now the
| > | treenodesrc is where I'm having my problem. I'm trying to send a
dynamic
| > | variable into sql in order to return the associated records ("Item
Status
| > | Details") using --
| > |
| >
TreeNodeSrc="http://www.domain.com/sqlDataBaseName?sql=execute+StoredProcedu
| > | reName+@variable=&variable". The variable comes to the page through a
| > | querystring. Of course my code reflects my specifics. But I've set up
| > | XMLSQL, and when I hard code the variable into the string it works
| > perfectly.
| > | The query works, my stored procedure returns the proper XML, and my
| > TreeView
| > | looks exactly how I want it to look. But when I try to put a dynamic
| > variable
| > | in I get a Parser Error and says "The literal string - and then my
| > | treenodesrc string - was found. Literal strings are not allowed
within
| > this
| > | control.
| > |
| > | All that I'm trying to do is send a dynamic variable into that
| > treenodesrc
| > | string where that &variable is above.
| > |
| > | Hopefully I've explained this well enough. Let me know.
| > |
| > | Thanks.
| > |
| > |
| >
| >
|

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Benny Raymond | last post by:
More problems with this... When I run this code, the main form returns an invalid cast exception as it's executing the line "TreeNode n = (TreeNode) this.Nodes;" Does anyone know what would...
0
by: naija naija | last post by:
Hi All, I'm using the TreView Web Control for my MENU. And the Menu is populated from an XML file below. I want a way in which i can manipulate the XML when i want to manage it without having to...
0
by: claireCSHARPuser | last post by:
Hi I'm having a problem with a tree view. The data source for this an XML string set using the TreeView.TreeNodeSrc property in the code behind page. The XML is generated by a stored procedure...
0
by: fred | last post by:
I am using the clipboard to copy and paste a TreeNode but the Tag property does not seem to be copied. I use the Tag property for an Object that contains data relating to the TreeNode. The Tag...
1
by: ghobley | last post by:
Hello, I have a Parent form call say MyProjectForm which is inherited, in this I have a variable call MyProjectItemNode of type treenode. I also have an overridable function called SelectNode in...
3
by: tanya foster | last post by:
Hello, I am re-writing a visual basic .net application(visual studio 2003) in an asp.net application(visual studio 2005). The vb.net application relied on a treeview and hence, treenodes. The...
3
by: ippo | last post by:
Hi all, I have a silly problem with treeview. I'm using .NET 2.0. I need to set the two properties treeNodeSrc - treeNodeTypeSrc at run time using C#, but in the treeViews that I define, these two...
1
by: jmDesktop | last post by:
I am trying to add nodes with keys to my treeview. I can add general nodes without problem with: //create new node TreeNode newNode = new TreeNode(myIdNumber); //create children TreeNode...
1
by: AAaron123 | last post by:
If you see this posted twice - sorry. My news reader showed my first post as "No Longer Available" I have the following in a .css file. The treeNodes behave as if they were "a" elements. ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.