ExpandAll Corrupts HTML Table format of TreeView Control

G

Guest

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.ExpandAll() 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=\"TreeImage\"> " +
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();
 
G

Guest

Fix was to use <td width="150"> rather 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.
 

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

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top