473,703 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.

StringCollectio n nodesChecked;
if(!Page.IsPost Back)
{
ViewState["Selected"] =
new StringCollectio n();
}
else
{
nodesChecked = new
StringCollectio n();
nodesChecked =
(StringCollecti on)ViewState["Selected"];
}
private void TreeView1_Check (object sender,
Microsoft.Web.U I.WebControls.T reeViewClickEve ntArgs e)
{
TreeView
treeView;
TreeNode
node;
string
strNodeChecked;

treeView =
(TreeView)sende r;

strNodeChecked = e.Node;
node =
treeView.GetNod eFromIndex(strN odeChecked);

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

nodesChecked.Ad d(node.Text);
}
else
{

nodesChecked.Re move(node.Text) ;
}

ViewState
["Selected"] = nodesChecked;

}

}

Nov 17 '05 #1
1 2173
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.

StringCollectio n nodesChecked;
if(!Page.IsPost Back)
{
ViewState["Selected"] =
new StringCollectio n();
}
else
{
nodesChecked = new
StringCollectio n();
nodesChecked =
(StringCollecti on)ViewState["Selected"];
}
private void TreeView1_Check (object sender,
Microsoft.Web.U I.WebControls.T reeViewClickEve ntArgs e)
{
TreeView
treeView;
TreeNode
node;
string
strNodeChecked;

treeView =
(TreeView)sende r;

strNodeChecked = e.Node;
node =
treeView.GetNod eFromIndex(strN odeChecked);

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

nodesChecked.Ad d(node.Text);
}
else
{

nodesChecked.Re move(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
2019
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 button from Form1 opens Form2 and a button in Form2 sends the user back to Form1. When the user goes back to Form1 from Form2, the TreeView control rebuilds the nodes incredibly slowly. You can see the progress, as the scroll bar slowly starts...
6
20063
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 unintended side-effect of toggling the expansion of that subtree. Thanks in advance, Brian
3
821
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 -DirC instead of: DirA | - DirB
5
19887
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 dynamic menu by collating data from a Sql Server Table. Many thanks.
8
4402
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
6824
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 TEXT="Document-1"> <TREENODE TEXT="Folder-1" EXPANDED="true"> <TREENODE TEXT="Document-2" />
6
4369
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 Control.Invoke or Control.BeginInvoke to perform this action. I have multiple background-threads that returns info about their progress through a Event. This event's handler is then on a Form that has the responsability to display all the info...
1
6362
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 stay on the control, but instead jumps back to the treeview. I'm setting the focus in the AfterSelect event of the treeview, and if I step through the code the desired control does have .Focused = True after I have set it, but then somewhere after...
3
4702
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 is if I close the application and then go back in, the nodes are back in the order they were before I had reordered them. Is there a way that I can modify my DragDrop event to permanently change the index of the nodes? Here's my code if you're...
0
8669
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9251
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9017
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7867
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6588
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5922
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3123
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2069
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.