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

running TreeView without viewstate


Hi,

Using a treeview with viewstate enabled easily generates very big viewstates
(hundreds of Ks). Does anyone have any experience of running treeviews
without viewstate?

To keep track of selected/clicked nodes I have added eventhandlers:
onselectedindexchange="javascript: if (this.clickedNodeIndex != null)
__saveSelectionState(this.clickedNodeIndex)"
oncheck="javascript: if (this.clickedNodeIndex != null)
__saveNodesState(this)"

and in Page_Load I retrieve the state...

protected void Page_Load(object sender, System.EventArgs e)
{
// Retain selected index
if ( IsPostBack )
{
string nodes = Request.Form[ statefield ];
if ( nodes == null )
nodes = "";

TreeView1.SelectedNodeIndex = nodes;
ExpandNodes( nodes ); // Make sure that selected node is visible
}

However, I sometimes get an error:
"The node at index 0.0 is not currently displayed in the tree.
SelectedNodeIndex cannot be set to an
undisplayed node (all parents of a selected node must be expanded)."

I have debugged the function ExpandNodes, which expands all nodes above the
selected one, but
can't find any problems.

Anybody have experience of this?

Thanks for any help!

Johan

---
Johan Åhlén
Bostadstips Sverige AB
Email: jo***@NObostadstipsSPAM.com <-- remove NOSPAM to email me
Web: http://www.bostadstips.com
Tel +46 31 842500

Nov 17 '05 #1
0 1291

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

Similar topics

2
by: Srinivasa Raghavan | last post by:
Hi I am using ASP Tree View Control to display data in hiearchy fashion.I am having a checkbox next to the TreeView Node.When user checks or unchecks the nodes and click a button i am putting...
1
by: Srinivasa Raghavan | last post by:
Hi All, I have some doubts on the Treeview control and Form Authentication 1) will Form Authentication work if cookies are disabled. 2) I have problem in the following code (TreeView...
2
by: rickpayne | last post by:
I've noticed the IE treeview asp.net web control has a heavey viewstate. I have been trying to use session variables to store its state instead of storing it in viewstate. Has anyone successful...
0
by: bill | last post by:
I'm upgrading an existing IIS application to .NET webforms. I need to preserve the existing look/feel - a covnentional 3-pane frameset with a header, left-side treeview menu, and content frame on...
5
by: Juanjo | last post by:
I need to know how to maintain de status (nodes expanded and selected) of a treeview in a master page. I have a master page with a treeview. I have a default page, when the treeview is expanded...
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...
4
by: Pål Andreassen | last post by:
We are using a TreeView defined in a MasterPage for navigation. The tree holds it's state turing postbacks just fine since it's using viewstate. But whenever a node click results in a redirect to a...
0
by: Alex D. | last post by:
Hi. I have a treeview with some checkboxes and I need to postback every time a checkbox is checked or unchecked automatically, so I do this: <asp:TreeView onclick="mypostback(event)" ID="TreeView1"...
1
by: kvicky | last post by:
I am trying to load child nodes to a TreeNode in a TreeView in a ASP.net web application. The Treeview with parent nodes are loaded on a Page_load while doing if( ! ISPostback ) and then in the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.