By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,223 Members | 1,371 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,223 IT Pros & Developers. It's quick & easy.

ASP TreevIew Control and Forms Authentication

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.