ExpandAll Corrupts HTML Table format of TreeView Control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Woof

    #1

    ExpandAll Corrupts HTML Table format of TreeView Control

    Hi,

    I'm populating the nodes of a Tree View control via an SQL database, with
    the lowest child nodes (leaves from now on) Text field being set to a lengthy
    set of HTML. The outcome is a beautifully formated list of data, where the
    leaves each show several rows from the SQL database.

    THE PROBLEM: When I expand each node level manually (clicking the +), the
    table format of the leaves is spot on, with each column of data formated
    correctly (I have hard coded the <TD style="width: 150"tag for each cell>.
    However, I've also added a 'Expand All' button at the top of the page which
    calls the TreeView.Expand All() method. This duly expands all the nodes but
    then destroys all the table formating I've created to keep each column of
    data spaced correctly.

    What have I done wrong?

    Many thanks.

    If the above didn't make sense, here's an actual line of code from the
    project:

    node.Text = "<table width=\"600\" class=\"Tree3\" ><tr><td
    style=\"width: 150\">" +
    "<img src=\"images/per.gif\" class=\"TreeIma ge\"" +
    row["Per_Name"].ToString() +
    "</td><td style=\"width: 150\">"
    + row["Rol_Name"].ToString() + "</td><td style=\"width: 250\">"
    + row["Rol_Email"].ToString() + "</td></tr></table>";
    node.Value = row["ID"].ToString();
  • Woof

    #2
    RE: ExpandAll Corrupts HTML Table format of TreeView Control

    Fix was to use <td width="150"rath er than <td style="width: 150">.

    Strange that the former works with manual node expansion, and that all DHTML
    tips urge you to use the style= format....

    Hope this helps other who may come across the same issue.

    "Woof" wrote:
    Hi,
    >
    I'm populating the nodes of a Tree View control via an SQL database, with
    the lowest child nodes (leaves from now on) Text field being set to a lengthy
    set of HTML. The outcome is a beautifully formated list of data, where the
    leaves each show several rows from the SQL database.
    >
    THE PROBLEM: When I expand each node level manually (clicking the +), the
    table format of the leaves is spot on, with each column of data formated
    correctly (I have hard coded the <TD style="width: 150"tag for each cell>.
    However, I've also added a 'Expand All' button at the top of the page which
    calls the TreeView.Expand All() method. This duly expands all the nodes but
    then destroys all the table formating I've created to keep each column of
    data spaced correctly.
    >
    What have I done wrong?
    >
    Many thanks.
    >
    If the above didn't make sense, here's an actual line of code from the
    project:
    >
    node.Text = "<table width=\"600\" class=\"Tree3\" ><tr><td
    style=\"width: 150\">" +
    "<img src=\"images/per.gif\" class=\"TreeIma ge\"" +
    row["Per_Name"].ToString() +
    "</td><td style=\"width: 150\">"
    + row["Rol_Name"].ToString() + "</td><td style=\"width: 250\">"
    + row["Rol_Email"].ToString() + "</td></tr></table>";
    node.Value = row["ID"].ToString();

    Comment

    Working...