Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 16th, 2007, 05:41 PM
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default TreeView extended

Hi everyone! I need help to cast a TreeNode into my own-defined TreeNode class (called ExtraTreeNode); the TreeNode has been added to the tree as ExtraTreeNode.

For example, I have some properties (p1, p2) in ExtraTreeNode.
Creating my object:

ExtraTreeNode tempnode = new ExtraTreeNode(p1,p2);
and adding:
TreeViewObj.Nodes.Add(tempnode);

The problem is later on (usually after a postback) when I try to reference to the node I cannot cast it using my class.
Example:

property =((ExtraTreeNode)TreeViewOBJ.Nodes[0]).p1;

Then I get the following error,
"Unable to cast object of type 'System.Web.UI.WebControls.TreeNode' to type 'ExtraTreeNode'".


If some has done this before and can give some feedback, it would be awesome.

Can the asp .net TreeNode class extended to persist user-defined properties?
If not what TreeView/node would you recommend?

Thanks,

Sean






Similar Threads
Thread Thread Starter Forum Replies Last Post
Exchange appointment extended fields via WebDAV villian C# 1 January 26th, 2011 05:29 AM
Extended Stored Procedure. a_boumerhi SQL Server 2000 1 June 4th, 2008 09:23 PM
Extended namespace not showing in xml lsindhu XSLT 1 January 18th, 2008 05:17 AM
Which browsers have support for extended Xlink? ballo XML 0 May 21st, 2006 07:23 AM
problem to deploye extended datasource Choose File BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 July 16th, 2004 10:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.