Hi Folks,
I hope someone can help me with a problem i'm having with the TreeView-control.
I'm using a custom TreeView (derived) that gives a postback when the user checks a checkbox, see code below. This works fine though, but now the TreeView isn't firing the SelectedNodeChanged event when clicking a node. It does postback though.
Am I missing something with the PostBackReference or something? I'm quite new in this, so bear with me :)
Here's the code for the custom TreeView:
public class TreeViewCheckbox : ASP.TreeView, IPostBackEventHandler
{
public event EventHandler CheckClick;
protected override void Render(HtmlTextWriter writer)
{
StringBuilder builder = new StringBuilder();
using (StringWriter stringWriter = new StringWriter(builder))
{
HtmlTextWriter tempWriter = new HtmlTextWriter(stringWriter);
base.Render(tempWriter);
}
string find = " string replace = "
writer.Write(builder.ToString().Replace(find, replace));
}
protected string getPostBack()
{
return this.Page.GetPostBackEventReference(this, "@CheckPostBack");
}
protected virtual void OnCheckClick(EventArgs e)
{
if (CheckClick != null) CheckClick(this, e);
}
void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
{
OnCheckClick(new EventArgs());
}
}
View Full Details...............................
No comments:
Post a Comment