hi, is there any easy way to show the expanded nodes so that when you save the data, refresh the page and coming back, you still have the same nodes expanded as when you left?. In more details, I have a radtreeview and the user can add or edit nodes, expanding direferents branches. Then when the user clicks the Save button the data is saved on the database and the radtreeview is shown with all nodes collapsed.
In the code I must do some business cheks so when the user clicks the Save button I save the data, I deletes all nodes in the radtreeview, I create (populate) the radtreeview again bringing the data from the database; then I try to expand those nodes that were expanded but this last thing does not work.
The code I use is the next:
In the code I must do some business cheks so when the user clicks the Save button I save the data, I deletes all nodes in the radtreeview, I create (populate) the radtreeview again bringing the data from the database; then I try to expand those nodes that were expanded but this last thing does not work.
The code I use is the next:
if
(!DuplicateExists)
{
oBF.SaveManageLines(oAIlevel3List);
// Delete all nodes in the RadTreeView.
for
(
int
a = 0; a < trTaxonomy.Nodes.Count; a++)
{
RadTreeNode oAICategory = trTaxonomy.Nodes[a];
for
(
int
b = 0; b < oAICategory.Nodes.Count; b++)
{
RadTreeNode level1Node = oAICategory.Nodes[b];
if
(level1Node.Nodes !=
null
&& level1Node.Nodes.Count > 0)
{
for
(
int
c = 0; c < level1Node.Nodes.Count; c++)
{
RadTreeNode level2Node = level1Node.Nodes[c];
if
(level2Node.Nodes !=
null
&& level2Node.Nodes.Count > 0)
{
for
(
int
d = 0; d < level2Node.Nodes.Count; d++)
{
level2Node.Nodes.Clear();
}
}
}
level1Node.Nodes.Clear();
}
}
oAICategory.Nodes.Clear();
}
trTaxonomy.Nodes.Clear();
// Create the RadTreeeView again, bringing the values from the DB.
string
[] ParamArray =
new
string
[4];
int
iLevelID = 1;
ParamArray[0] = iLevelID.ToString();
ParamArray[1] =
"0"
;
ParamArray[2] = _PartnershipID.ToString();
ParamArray[3] =
"1"
;
//BusinessFascade.Taxonomy oBF = new BusinessFascade.Taxonomy();
oBF =
new
BusinessFascade.Taxonomy();
dsAICategory = oBF.GetAllCategory(ParamArray);
foreach
(AICategory ai
in
dsAICategory)
{
rootNode =
new
RadTreeNode(ai.Name);
rootNode.Value = ai.ID.ToString();
rootNode.Text = ai.Name +
" ("
+ ai.TaxonomyCount +
")"
;
rootNode.Expanded =
false
;
rootNode.Checkable =
false
;
rootNode.AllowEdit =
false
;
rootNode.ExpandMode = TreeNodeExpandMode.ServerSideCallBack;
trTaxonomy.Nodes.Add(rootNode);
}
rootNode =
new
RadTreeNode(
"State"
);
rootNode.Value =
"-999"
;
rootNode.Text =
"State"
;
rootNode.Expanded =
false
;
rootNode.Checkable =
false
;
rootNode.AllowEdit =
false
;
rootNode.ExpandMode = TreeNodeExpandMode.ServerSideCallBack;
trTaxonomy.Nodes.Add(rootNode);
//Added node to show State Source Income Categories
rootNode =
new
RadTreeNode(
"State Source Schedule"
);
rootNode.Value =
"-2"
;
rootNode.Text =
"State Source Schedule"
;
rootNode.Expanded =
false
;
rootNode.Checkable =
false
;
rootNode.AllowEdit =
false
;
rootNode.ExpandMode = TreeNodeExpandMode.ServerSideCallBack;
trTaxonomy.Nodes.Add(rootNode);
// Expand the nodes. Review why is not working.
for
(
int
w = 0; w < oAICategoryList.Count; w++)
{
ExpandNode(oAICategoryList[w]);
}
for
(
int
z = 0; z < level1NodeList.Count; z++)
{
ExpandNode(level1NodeList[z]);
}
for
(
int
y = 0; y < level2NodeList.Count; y++)
{
ExpandNode(level2NodeList[y]);
}
trTaxonomy.ExpandAllNodes();
}
}