Hi,
I am adding Node Templates like;
And here is my BoxTemplate class;
I couldn't figure it out how to add server side click event to my delButton and handle it at code behind.
Any help would be appreciated. TIA.
I am adding Node Templates like;
protected
void
RadTreeView2_TemplateNeeded(
object
sender, RadTreeNodeEventArgs e)
{
bool
someCondition =
true
;
if
(someCondition)
e.Node.NodeTemplate =
new
BoxTemplate();
else
e.Node.NodeTemplate =
new
OtherTemplate();
}
And here is my BoxTemplate class;
class
BoxTemplate : ITemplate
{
public
void
InstantiateIn(Control container)
{
Label nodeLabel =
new
Label();
nodeLabel.ID =
"NodeLabel"
;
nodeLabel.DataBinding +=
new
EventHandler(NodeLabel_DataBinding);
container.Controls.Add(nodeLabel);
ImageButton delButton =
new
ImageButton();
delButton.ImageUrl =
"~/images/icons/delete16.png"
;
delButton.OnClientClick =
"return ConfirmDelete();"
;
container.Controls.Add(delButton);
}
private
void
NodeLabel_DataBinding(
object
sender, EventArgs e)
{
Label theLabel= (Label)sender;
RadTreeNode node = (RadTreeNode)theLabel.BindingContainer;
theLabel.Text = (
string
)DataBinder.Eval(node,
"Text"
);
}
}
I couldn't figure it out how to add server side click event to my delButton and handle it at code behind.
Any help would be appreciated. TIA.