472,989 Members | 3,063 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,989 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 1789
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
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.