Display HTML controls inside MS Treeview control.

This is the final product, looks very nice ;-).

Well, if you will add decode HTML to a TreeView node text the browser will render that HTML into visual controls inside the tree:

Microsoft.Web.UI.WebControls.TreeNode oNode1 = new Microsoft.Web.UI.WebControls.TreeNode();

oNode1.Text = Server.HtmlDecode("<INPUT style=\"Z-INDEX: 104\" type=\"text\">");

Microsoft.Web.UI.WebControls.TreeNode oNode = new Microsoft.Web.UI.WebControls.TreeNode();

oNode.Text = Server.HtmlDecode("<INPUT style=\"Z-INDEX: 104\" type=\"text\">");

oNode.Nodes.Add (oNode1);

this.TreeView2.Nodes.Add(oNode); 

As you see it’s pretty easy and might be useful. Naturally you can assign any attributes to those HTML controls, such as ID or events (including PostBacks).

Published Monday, December 22, 2003 2:52 PM by nattYGUR

Comments

# re: Display HTML controls inside MS Treeview control.

Sunday, June 20, 2004 9:55 PM by shankar
Hi i am happy to find this article which i was searching for. Can u pls explain how can we get the values from the html control.
thank u.

# re: Display HTML controls inside MS Treeview control.

Tuesday, June 22, 2004 4:04 PM by Natty Gur
Using FindControl(). you just need to add ID and runat=server to insert HTML.

# re: Display HTML controls inside MS Treeview control.

Saturday, January 12, 2008 2:26 AM by Jitendta

hello i added HTML radio button to the tree view nodes text with some other text.

well i cretaed the interface but the problem is that i m not being able to access these controls even by findControl method.

how can i access these radion button states?

Leave a Comment

(required) 
(required) 
(optional)
(required)