tabular treeview

Discussion in 'ASP .Net Building Controls' started by Koen Hakvoort, Jan 8, 2006.

  1. 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();

    }

    }

    }
    Koen Hakvoort, Jan 8, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Edward

    Dynamically sized tabular display

    Edward, Feb 4, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    397
    Wardeaux
    Feb 4, 2004
  2. tolaskram
    Replies:
    1
    Views:
    545
    sloan
    Jan 27, 2006
  3. t
    Replies:
    3
    Views:
    580
    Pier Paolo
    Feb 16, 2006
  4. Luigi Donatello Asero

    Layout versus tabular data.

    Luigi Donatello Asero, Oct 14, 2005, in forum: HTML
    Replies:
    8
    Views:
    485
    Luigi Donatello Asero
    Oct 14, 2005
  5. Gufus

    tabular vs tables

    Gufus, Mar 16, 2006, in forum: HTML
    Replies:
    3
    Views:
    607
    Neredbojias
    Mar 16, 2006
Loading...

Share This Page