473,385 Members | 1,292 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,385 software developers and data experts.

ASP.net 2.0 TreeView SelectExpand

Hi,

For some reason I cannot get a parent node to perform the SelectExpand
behavior when clicked if I am defining a Url value in my Web.sitemap.
It works fine if I leave the Url field blank, but then it throws off my
SiteMapPath (bread crumb trail) because it won't show a clickable link.

I believe the reason is because when you navigate to a URL, it is not
performing a postback which normally triggers the SelectExpand
behavior.

There must be some custom code that I can use so that it navigates to
the URL **AND** performs the SelectExpand behavior.

I hope someone can help me with this. I've been going nuts trying to
figure it out and apparently it's a limitation of the control.

Thanks!

-Alex

Mar 8 '06 #1
1 1455
We wrote some custom code to get this working.

I figured I would post it for anyone who is stuck like I was:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
try
{
TreeView1.DataBind();
TreeView1.FindNode(SiteMap.CurrentNode.Title).Expa nd();
}
catch
{
}
}
}

Dropping this into your c# code behind page will do the trick.
Mimo169 wrote:
Hi,

For some reason I cannot get a parent node to perform the SelectExpand
behavior when clicked if I am defining a Url value in my Web.sitemap.
It works fine if I leave the Url field blank, but then it throws off my
SiteMapPath (bread crumb trail) because it won't show a clickable link.

I believe the reason is because when you navigate to a URL, it is not
performing a postback which normally triggers the SelectExpand
behavior.

There must be some custom code that I can use so that it navigates to
the URL **AND** performs the SelectExpand behavior.

I hope someone can help me with this. I've been going nuts trying to
figure it out and apparently it's a limitation of the control.

Thanks!

-Alex


Mar 10 '06 #2

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

Similar topics

0
by: Tony Sedgwick | last post by:
I've created a treeview that sits in a separate frame to the main frame and is loaded dynamically from a SQL db. Everything was working fine until I needed a node that could both Expand to...
2
by: Stephen | last post by:
In asp.net 1.1, the IE treeview web control has a property called "SelectExpands" that, when set to true, expands a node when a user clicks the node text. I can't seem to replicate this in the...
5
by: Dotnet Gruven | last post by:
With this TreeView declaration: <asp:TreeView ID="Cloner" runat="server" SelectedNodeStyle-Font-Bold="true" SelectedNodeStyle-ForeColor="#003E21" OnTreeNodePopulate="PopulateNode"...
1
by: jesper_lofgren | last post by:
Hello, Iam using Treeview control in asp.net 2.0. But have a problem. I use NavigateUrl BUT then viewstate is lost when clicked on a link i the menu. And the selected node is lost. Then i...
1
by: aaronh64 | last post by:
I'm trying to bind to the ASP.NET TreeView control and utilize the PopulateOnDemand functionality. However, I am receiving the following (very confusing) error: "PopulateOnDemand only supported...
11
by: pbd22 | last post by:
Hi. I am getting odd treeview results and hope you can help. I am parsing a string, "x/y/z", turning it into an array (that always seems to start with an empty string) and then using the...
1
by: Falcula | last post by:
Hello, I have a treeview control, when i select a item i navigate to url. But selected node is lost, it reset itself, loosing state. I post my code here. Thanks in advance. <script...
0
by: Falcula | last post by:
Hello, I have a treeview that i fill from a database, when i update nodename in database the treeview dont update. Its works when iam not useing enableviewstate="true" but then i loosing the...
2
by: =?Utf-8?B?QU5V?= | last post by:
I have a tree view which i load completely at the time of my webpage load. When i click on the + signs of the parent nodes, it expands to show all of its children. Similarly, when i click on the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.