Hi;
I have a problem when I want a selected node and Group / Ungroup the tree holding the selected node. Here's an example to understand the case:
If I have a selected node when calling the method to group / ungroup not maintained after I selected group / ungroup. I tried with what appears in the code but can not.
Thanks for the help.
Regards!
I have a problem when I want a selected node and Group / Ungroup the tree holding the selected node. Here's an example to understand the case:
public
Form1()
{
InitializeComponent();
DataTable table =
new
DataTable();
table.Columns.Add(
"ID"
,
typeof
(
int
));
table.Columns.Add(
"ID_PADRE"
,
typeof
(
int
));
table.Columns.Add(
"Codigo"
,
typeof
(
string
));
table.Columns.Add(
"TEXTO_NODO"
,
typeof
(
string
));
table.Columns.Add(
"TIPO"
,
typeof
(
string
));
table.Rows.Add(1,
null
,
"COD 1"
,
"Descripción 1"
,
"C"
);
table.Rows.Add(2,
null
,
"COD 2"
,
"Descripción 2"
,
"E"
);
table.Rows.Add(3,
null
,
"COD 3"
,
"Descripción 3"
,
"A"
);
table.Rows.Add(4,
null
,
"COD 4"
,
"Descripción 4"
,
"S"
);
table.Rows.Add(5,
null
,
"COD 5"
,
"Descripción 5"
,
"R"
);
table.Rows.Add(6, 1,
"COD 6"
,
"Descripción 6"
,
"S"
);
table.Rows.Add(7, 2,
"COD 7"
,
"Descripción 7"
,
"R"
);
table.Rows.Add(8, 3,
"COD 8"
,
"Descripción 8"
,
"R"
);
table.Rows.Add(9, 4,
"COD 9"
,
"Descripción 9"
,
"S"
);
table.Rows.Add(10, 5,
"COD 10"
,
"Descripción 10"
,
"C"
);
table.Rows.Add(11, 1,
"COD 11"
,
"Descripción 11"
,
"R"
);
table.Rows.Add(12, 2,
"COD 12"
,
"Descripción 12"
,
"S"
);
table.Rows.Add(13, 3,
"COD 13"
,
"Descripción 13"
,
"A"
);
table.Rows.Add(14, 4,
"COD 14"
,
"Descripción 14"
,
"E"
);
table.Rows.Add(15, 5,
"COD 15"
,
"Descripción 15"
,
"R"
);
table.Rows.Add(16, 6,
"COD 16"
,
"Descripción 16"
,
"S"
);
table.Rows.Add(17, 7,
"COD 17"
,
"Descripción 17"
,
"E"
);
table.Rows.Add(18, 8,
"COD 18"
,
"Descripción 18"
,
"R"
);
table.Rows.Add(19, 9,
"COD 19"
,
"Descripción 19"
,
"C"
);
table.Rows.Add(20, 10,
"COD 20"
,
"Descripción 20"
,
"A"
);
table.Rows.Add(21, 20,
"COD 21"
,
"Descripción 21"
,
"S"
);
this
.radTreeView1.DataSource = table;
this
.radTreeView1.DisplayMember =
"TEXTO_NODO"
;
this
.radTreeView1.ChildMember =
"ID"
;
this
.radTreeView1.ParentMember =
"ID_PADRE"
;
this
.radTreeView1.ExpandAll();
this
.radGridView1.Relations.AddSelfReference(
this
.radGridView1.MasterTemplate,
"ID_PADRE"
,
"ID"
);
this
.radGridView1.DataSource = table;
}
private
void
ungroup()
{
RadTreeNode oNode =
this
.radTreeView1.SelectedNode;
this
.radTreeView1.ChildMember =
""
;
this
.radTreeView1.ParentMember =
""
;
this
.radTreeView1.SelectedNode = oNode;
}
private
void
group()
{
RadTreeNode oNode =
this
.radTreeView1.SelectedNode;
this
.radTreeView1.ChildMember =
"ID"
;
this
.radTreeView1.ParentMember =
"ID_PADRE"
;
this
.radTreeView1.ExpandAll();
this
.radTreeView1.SelectedNode = oNode;
}
private
void
label1_Click(
object
sender, EventArgs e)
{
this
.ungroup();
}
private
void
label2_Click(
object
sender, EventArgs e)
{
this
.group();
}
If I have a selected node when calling the method to group / ungroup not maintained after I selected group / ungroup. I tried with what appears in the code but can not.
Thanks for the help.
Regards!