473,395 Members | 2,253 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,395 software developers and data experts.

ASP TreevIew Control and Forms Authentication

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 Control
with checkbox)

When I click on the checkbox in treeview with autopostback
false,the count in view state is going wrong when uncheck
and check .Please suggest any solutions.

StringCollection nodesChecked;
if(!Page.IsPostBack)
{
ViewState["Selected"] =
new StringCollection();
}
else
{
nodesChecked = new
StringCollection();
nodesChecked =
(StringCollection)ViewState["Selected"];
}
private void TreeView1_Check(object sender,
Microsoft.Web.UI.WebControls.TreeViewClickEventArg s e)
{
TreeView
treeView;
TreeNode
node;
string
strNodeChecked;

treeView =
(TreeView)sender;

strNodeChecked = e.Node;
node =
treeView.GetNodeFromIndex(strNodeChecked);

// the
node will have been checked or unchecked
if
(node.Checked)
{

nodesChecked.Add(node.Text);
}
else
{

nodesChecked.Remove(node.Text);
}

ViewState
["Selected"] = nodesChecked;

}

}

Nov 17 '05 #1
1 2151
Looking at number two first. If you have autopostback set to false,
something like IE isn't necessarily going to post back to the server. I know
it's annoying to round-trip things, but setting autopostback to on is the
best option for a treeview where you have to interact, such as when you're
building dynamic nodes or when you're using the checkbox. To see if it's
working, you can add a response.write at the beginning of your check event
handler for the checkbox to write something like "checked" everytime the
event fires. That will definitely help you determine if the event is really
firing or not. Also note that the treeview will have very different
behaviors on Navigator, or other non-IE browsers.

Forms authentication uses cookies to store an authentication cookie on the
browser so it pretty much needs cookies to store the authentication.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"Srinivasa Raghavan" <s_******************@hotmail.com> wrote in message
news:01****************************@phx.gbl...
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 Control
with checkbox)

When I click on the checkbox in treeview with autopostback
false,the count in view state is going wrong when uncheck
and check .Please suggest any solutions.

StringCollection nodesChecked;
if(!Page.IsPostBack)
{
ViewState["Selected"] =
new StringCollection();
}
else
{
nodesChecked = new
StringCollection();
nodesChecked =
(StringCollection)ViewState["Selected"];
}
private void TreeView1_Check(object sender,
Microsoft.Web.UI.WebControls.TreeViewClickEventArg s e)
{
TreeView
treeView;
TreeNode
node;
string
strNodeChecked;

treeView =
(TreeView)sender;

strNodeChecked = e.Node;
node =
treeView.GetNodeFromIndex(strNodeChecked);

// the
node will have been checked or unchecked
if
(node.Checked)
{

nodesChecked.Add(node.Text);
}
else
{

nodesChecked.Remove(node.Text);
}

ViewState
["Selected"] = nodesChecked;

}

}

Nov 17 '05 #2

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

Similar topics

9
by: Jim | last post by:
The below problem occurs randomly too, but I've managed to isolate a sequence of events when it always happens: I have two forms (say Form1 and Form2). Form 1 contains a TreeView control. A...
6
by: Brian Smith | last post by:
Is there a way to avoid the default action of TreeNode expansion/contraction caused by double click? I can add an event handler to pop up my properties dialog on double click, but it has the...
3
by: feel | last post by:
Goin' crazy with this recursive function ported from delphi... I send a string like DirA/ DirB /DirC but i get in the treeView each one in a new node.Cant get the child node....!! -DirA -DirB...
5
by: SoKool | last post by:
Can anyone point me to a site where I can get a free treeview control to use in ASP .NET or any tutorial that can help me build my own treeview control. I intend to use a treeview to generate a...
8
by: Hrvoje Voda | last post by:
What is wrong in this code? private void tree_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.Enter ) {
14
by: Evan Kontos | last post by:
I am trying to implement a Treeview w/an XML file and I even copied and pasted examples from MSDN but can't get them to work. Any suggestions welcome. XML File <TREENODES> <TREENODE...
6
by: Jarod_24 | last post by:
This is the exception i'm getting: System.InvalidOperationException: The action being performed on this control is being called from the wrong thread. You must marshal to the correct thread using...
1
by: mongphong28 | last post by:
Hi, I'm using a treeview as a menu, and when the user clicks on a node I want the focus to set to a control (ie textbox) in a panel to the right. The problem I'm having is the focus will not...
3
by: dutsnekcirf | last post by:
I have a treeview control on a custom task pane in Excel. I've enable the ability to use Drag & Drop (by following this how-to) on the treeview to change the order of the nodes. The problem though...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.