470,647 Members | 1,313 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,647 developers. It's quick & easy.

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 2012
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Jim | last post: by
6 posts views Thread by Brian Smith | last post: by
3 posts views Thread by feel | last post: by
5 posts views Thread by SoKool | last post: by
8 posts views Thread by Hrvoje Voda | last post: by
14 posts views Thread by Evan Kontos | last post: by
6 posts views Thread by Jarod_24 | last post: by
1 post views Thread by mongphong28 | last post: by
reply views Thread by warner | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.