tabular treeview

K

Koen Hakvoort

Hello,

Addition to question posted on 1-5-2006 in dotnet.framework.aspnet:

In order to create a message board like this one
http://www.prikpagina.nl/read.php?f=18&i=168071&t=168071 with a read-only
treeview. I've tried to build a
custom treeview with three colums, derived from the asp.net 2.0 treenode
of the treeview web control. The three node-columns are filled
programmatically. Something like this with textboxes for simplicity's sake.
The example in php succeeds in wrapping the text in the first column. Unable
to find out of the custom treeview could possibly do such a thing. Does
anybody know a solution? Or should I follow a different road in asp.net to
achieve this.



using System;

using System.Collections;

using System.ComponentModel;

using System.Drawing;

using System.Data;

using System.Web.UI;

using System.Web.UI.WebControls;





namespace Test

{

public class MyTreeNode : TreeNode

{

private string _text2;

private string _text3;

private string _nodeStyle;

public MyTreeNode()

{ }

public MyTreeNode(string Text, string Value)

{

this.Text = Text;

this.Value = Value;

}

public MyTreeNode(string Text, string Value, string Text2, string Text3)

{

this.Text = Text;

this.Value = Value;

_text2 = Text2;

_text3 = Text3;

}

protected override void RenderPreText(System.Web.UI.HtmlTextWriter writer)

{


//writer.AddStyleAttribute("width", "500px");

}





protected override void RenderPostText(System.Web.UI.HtmlTextWriter writer)

{

writer.AddAttribute("type", "text");

writer.AddStyleAttribute("left", "500px");

writer.AddAttribute("value",_text2);

writer.AddStyleAttribute("position", "absolute");

writer.RenderBeginTag(HtmlTextWriterTag.Input);

writer.RenderEndTag();

writer.AddAttribute("type", "text");

writer.AddStyleAttribute("left", "675px");

writer.AddAttribute("value", _text3);

writer.AddStyleAttribute("position", "absolute");

writer.RenderBeginTag(HtmlTextWriterTag.Input);

writer.RenderEndTag();




writer.AddAttribute("style", this._nodeStyle);


}





public string NodeStyle

{

set { this._nodeStyle = value; }

}

}






[DefaultProperty("Text")][ToolboxData("<{0}:MyTreeView
runat=server></{0}:MyTreeView>")]

public class MyTreeView : TreeView

{

protected override TreeNode CreateNode()

{

return new MyTreeNode();

}

}

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top