S
Srinivasa Raghavan
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.TreeViewClickEventArgs 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;
}
}
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.TreeViewClickEventArgs 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;
}
}