.NETGURU
Dynamic generation of the TreeNodeSrc in the Expand event
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngwebcontrols' list.


Vladimir Chernetsky
Hello,

I need to implement immense item hierarchy with TreeView.
So I need TreeView to be built like a MSDN TOC sample
(each Expand event generates xml nodes source only for expanded node,
not for all TreeView)

So, does a nice way to do it exist? I see that TreeViewClickEventArgs class
does not have
a reference to the TreeNode that caused Expand event, so I cannot set
dynamically TreeNodeSrc only for this node.

Thanx in advance,

Vladimir Chernetsky
CnetChannel Research & Development
<mailto:Click here to reveal e-mail address>
Reply to this message...
 
    
Pierre Thomasius
Dynamic generation of the TreeNodeSrc in the Expand eventHi Vladimir,

what i have done is have a aspx page as the TreeNodeSrc with a parameter
i.e. (<TreeNode Text="Nuevedades" TreeNodeSrc="menuXML.aspx?id=7">).
that menuXML.aspx can then filter a DB for the param and write out the xml
to the outputstream.

With this u would only have to provide the first layer of your TreeView and
all subsequent layers would be generated on postback for the particular item
clicked.

Pierre

-----Original Message-----
From: Vladimir Chernetsky [mailto:Click here to reveal e-mail address]
Sent: 20 May 2002 10:44
To: aspngwebcontrols
Subject: [aspngwebcontrols] Dynamic generation of the TreeNodeSrc in the
Expand event

Hello,

I need to implement immense item hierarchy with TreeView.
So I need TreeView to be built like a MSDN TOC sample
(each Expand event generates xml nodes source only for expanded node,
not for all TreeView)

So, does a nice way to do it exist? I see that TreeViewClickEventArgs
class does not have
a reference to the TreeNode that caused Expand event, so I cannot set
dynamically TreeNodeSrc only for this node.

Thanx in advance,

Vladimir Chernetsky
CnetChannel Research & Development
<mailto:Click here to reveal e-mail address>

| [aspngwebcontrols] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngwebcontrols.asp = JOIN/QUIT
Reply to this message...
 
    
Pierre Thomasius
Dynamic generation of the TreeNodeSrc in the Expand eventHi Vladimir,

exactly that will happen. The good thing is u could in theory have one aspx
page write all the xml or have one aspx page for each level. That helps with
very large trees cause you only process the first level and then the second
on postback after clicking one option and so on.
-----Original Message-----
From: Vladimir Chernetsky [mailto:Click here to reveal e-mail address]
Sent: 21 May 2002 07:11
To: aspngwebcontrols
Subject: [aspngwebcontrols] RE: Dynamic generation of the TreeNodeSrc in
the Expand event

Hi Pierre,

Oh, does it mean that if you have TreeNodeSrc property set to some aspx
page URL,
then after calling TreeView.Databind() method TreeView control will call
this URL for actual xml stream?

btw I found the way...it's just a bit tricky - to get reference to node
that raised Expand event you should do the following:
TreeNode sourceNode ((TreeView)sender).GetNodeFromIndex(e.Node.ToString());

All event handler code looks like:

private void TreeCtrl_Expand(object sender,
Microsoft.Web.UI.WebControls.TreeViewClickEventArgs e)

{

TreeNode sourceNode ((TreeView)sender).GetNodeFromIndex(e.Node.ToString());

sourceNode.TreeNodeSrc = TreeManager.GetNodeSource(sourceNode.ID); // my
own function that returns TREENODES xml

sourceNode.Databind();

}

-----Original Message-----
From: Pierre Thomasius [mailto:Click here to reveal e-mail address]
Sent: Monday, May 20, 2002 4:47 PM
To: aspngwebcontrols
Subject: [aspngwebcontrols] RE: Dynamic generation of the TreeNodeSrc in
the Expand event

Hi Vladimir,

what i have done is have a aspx page as the TreeNodeSrc with a parameter
i.e. (<TreeNode Text="Nuevedades" TreeNodeSrc="menuXML.aspx?id=7">).
that menuXML.aspx can then filter a DB for the param and write out the
xml to the outputstream.

With this u would only have to provide the first layer of your TreeView
and all subsequent layers would be generated on postback for the particular
item clicked.

Pierre
-----Original Message-----
From: Vladimir Chernetsky [mailto:Click here to reveal e-mail address]
Sent: 20 May 2002 10:44
To: aspngwebcontrols
Subject: [aspngwebcontrols] Dynamic generation of the TreeNodeSrc in
the Expand event

Hello,

I need to implement immense item hierarchy with TreeView.
So I need TreeView to be built like a MSDN TOC sample
(each Expand event generates xml nodes source only for expanded node,
not for all TreeView)

So, does a nice way to do it exist? I see that TreeViewClickEventArgs
class does not have
a reference to the TreeNode that caused Expand event, so I cannot set
dynamically TreeNodeSrc only for this node.

Thanx in advance,

Vladimir Chernetsky
CnetChannel Research & Development
<mailto:Click here to reveal e-mail address>

| [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...
 
 
System.Windows.Forms.TreeNode
System.Windows.Forms.TreeView




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification