I have a treeview which i have used extended template
public
class
MyNodeTemplate : ITemplate
{
public
string
StrText {
get
;
set
; }
public
void
InstantiateIn(Control container)
{
var txt =
new
TextBox();
if
(!String.IsNullOrEmpty(StrText))
{
txt.Width =
new
Unit(StrText.Length, UnitType.Em);
txt.Text = StrText;
}
container.Controls.Add(txt);
}
}
I am binding it on some dropdownlist selected index change event
if
(ddlTemplateSource.SelectedValue !=
"0"
)
{
TreeView1.Nodes.Clear();
var lstSections = SourceSectionBll.GetInstance.GetSourceSectionsByTemplateSourceId(Int32.Parse(ddlTemplateSource.SelectedValue));
if
(lstSections !=
null
)
{
if
(obj.LstSimpleFieldSectionMappers !=
null
&& )
{
var tNodeChildSimpleFields =
new
RadTreeNode(
"Simple_fields_Control"
);
foreach
(var objSimplefield
in
obj.LstSimpleFields)
{
var tNodeChildSimpleFieldTextEntry =
new
RadTreeNode(objSimplefield.FieldName);
var tSimpleFiledLeafNode =
new
RadTreeNode {Expanded =
true
};
var objtemplate =
new
MyNodeTemplate {StrText = objSimplefield.FieldCode};
objtemplate.InstantiateIn(tSimpleFiledLeafNode);
tNodeChildSimpleFieldTextEntry.Nodes.Add(tSimpleFiledLeafNode);
tNodeChildSimpleFields.Nodes.Add(tNodeChildSimpleFieldTextEntry);
}
tNode.Nodes.Add(tNodeChildSimpleFields);
}
TreeView1.Nodes.Add(tNode);
}
}
Problem is that treeview loses text inside the textbox when there is a button click event is triggerd
Anyway i can intact the data in the text box of MyNodeTemplate template?