custom TreeNode and SelectNodeChanged
- by gilloux
Hello,
I'm working on asp.net
I've written a custom Treenode (customTreeNode) that I use to populate a treeview
the problem comes up when firing the selectnodechanged event
this event give me a TreeNode object and not a customTreeNode
and I cannot seem to cast it somehow,
does sy have a clue ?
Thx
here is the code I have
populate my tree
node.ChildNodes.Add
(
customTreeNode = new customTreeNode(site)
);
customTreeNode
public class customTreeNode : TreeNode
{
public Guid Id { get; set; }
private SPWebEntry _dataContext;
public SPWebEntry DataContext
{
get
{
return _dataContext;
}
}
public customTreeNode(SPWebEntry DataContext)
{
_dataContext = DataContext;
this.Text = _dataContext.Title;
this.Id = _dataContext.Id;
}
}
and the event
void treeViewSiteCollection_SelectedNodeChanged(object sender, EventArgs e)
{
treeViewSiteCollection.SelectedNode;
}
treeViewSiteCollection.SelectedNode is of type TreeNode and I cannot cast it.
Thx guys