How to enter a variable in the treenodesrc of a treenode

G

Guest

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.
 
S

Steven Cheng[MSFT]

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=?="
<[email protected]>
| 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: <[email protected]>
| 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.
|
|
 
G

Guest

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 said:
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=?="
<[email protected]>
| 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: <[email protected]>
| 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.
|
|
 
S

Steven Cheng[MSFT]

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=?="
<[email protected]>
| References: <[email protected]>
<[email protected]>
| 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: <[email protected]>
| 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=?="
| > <[email protected]>
| > | 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: <[email protected]>
| > | 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.
| > |
| > |
| >
| >
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top