I'm populating my tree view nodes using code behind. I'm applying back ground color to the child nodes. Each chidl node is of different size. I want all the child nodes to be of the same size (like a table row). How do I set the width of the node? I tried to set the node width property, but it doesn't work.
Here is my code. In the following code, child node's text "hello" and "Hi there how are you and how is life" are of two different sizes. I would like to set the node width, so that both the nodes appear to look like they are in a table. I tried the text in table, still didn't work. Any ideas?
protected void st_NodeExpand(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
{
rdr = ......
while (rdr.Read())
{
RadTreeNode node = new RadTreeNode();
if (rdr["Sex"].ToString() == "Male")
{
node.BackColor = System.Drawing.ColorTranslator.FromHtml("#dfe7fa");
node.Text = "<font color='#00685c'><a href='" + rdr["PortraidID"] + "'>" + "Hello"+"</a></font>";
}
else
{
node.Text = "<font color='#00685c'><a href='" + rdr["PortraidID"] + "'>" + "Hi there how are you and how is life"+"</a></font>";
node.BackColor = System.Drawing.ColorTranslator.FromHtml("#fdebfb");
}
node.Value = rdr["PortraidID"].ToString();
e.Node.Nodes.Add(node);
e.Node.Expanded = true;
}
rdr = new Select("PortraidID,BirthDate,FirstName,LastName,FatherFN,MotherFN,Sex")
.From("BirthDetails")
.Where("Month(BirthDate)").IsEqualTo(Convert.ToInt32(month))
.And("Year(BirthDate)").IsEqualTo(Convert.ToInt32(my[1]))
.OrderAsc("BirthDate")
.ExecuteReader();
while (rdr.Read())
{
RadTreeNode node = new RadTreeNode();
if (rdr["Sex"].ToString() == "Male")
{
node.BackColor = System.Drawing.ColorTranslator.FromHtml("#dfe7fa");
node.Text = "<font color='#00685c'><a href='BabyDetail.aspx?id=" + rdr["PortraidID"] + "'>" + Convert.ToDateTime(rdr["BirthDate"].ToString()).ToShortDateString() + " " + rdr["FirstName"] + " " + rdr["LastName"] + "- Son of " + rdr["FatherFN"] + " & " + rdr["MotherFN"] + "</a></font>";
}
else
{
node.Text = "<font color='#00685c'><a href='BabyDetail.aspx?id=" + rdr["PortraidID"] + "'>" + Convert.ToDateTime(rdr["BirthDate"].ToString()).ToShortDateString() + " " + rdr["FirstName"] + " " + rdr["LastName"] + "- Daughter of " + rdr["FatherFN"] + " & " + rdr["MotherFN"] + "</a></font>";
node.BackColor = System.Drawing.ColorTranslator.FromHtml("#fdebfb");
}
node.Value = rdr["PortraidID"].ToString();
e.Node.Nodes.Add(node);
e.Node.Expanded = true;
}
Here is my code. In the following code, child node's text "hello" and "Hi there how are you and how is life" are of two different sizes. I would like to set the node width, so that both the nodes appear to look like they are in a table. I tried the text in table, still didn't work. Any ideas?
protected void st_NodeExpand(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
{
rdr = ......
while (rdr.Read())
{
RadTreeNode node = new RadTreeNode();
if (rdr["Sex"].ToString() == "Male")
{
node.BackColor = System.Drawing.ColorTranslator.FromHtml("#dfe7fa");
node.Text = "<font color='#00685c'><a href='" + rdr["PortraidID"] + "'>" + "Hello"+"</a></font>";
}
else
{
node.Text = "<font color='#00685c'><a href='" + rdr["PortraidID"] + "'>" + "Hi there how are you and how is life"+"</a></font>";
node.BackColor = System.Drawing.ColorTranslator.FromHtml("#fdebfb");
}
node.Value = rdr["PortraidID"].ToString();
e.Node.Nodes.Add(node);
e.Node.Expanded = true;
}
rdr = new Select("PortraidID,BirthDate,FirstName,LastName,FatherFN,MotherFN,Sex")
.From("BirthDetails")
.Where("Month(BirthDate)").IsEqualTo(Convert.ToInt32(month))
.And("Year(BirthDate)").IsEqualTo(Convert.ToInt32(my[1]))
.OrderAsc("BirthDate")
.ExecuteReader();
while (rdr.Read())
{
RadTreeNode node = new RadTreeNode();
if (rdr["Sex"].ToString() == "Male")
{
node.BackColor = System.Drawing.ColorTranslator.FromHtml("#dfe7fa");
node.Text = "<font color='#00685c'><a href='BabyDetail.aspx?id=" + rdr["PortraidID"] + "'>" + Convert.ToDateTime(rdr["BirthDate"].ToString()).ToShortDateString() + " " + rdr["FirstName"] + " " + rdr["LastName"] + "- Son of " + rdr["FatherFN"] + " & " + rdr["MotherFN"] + "</a></font>";
}
else
{
node.Text = "<font color='#00685c'><a href='BabyDetail.aspx?id=" + rdr["PortraidID"] + "'>" + Convert.ToDateTime(rdr["BirthDate"].ToString()).ToShortDateString() + " " + rdr["FirstName"] + " " + rdr["LastName"] + "- Daughter of " + rdr["FatherFN"] + " & " + rdr["MotherFN"] + "</a></font>";
node.BackColor = System.Drawing.ColorTranslator.FromHtml("#fdebfb");
}
node.Value = rdr["PortraidID"].ToString();
e.Node.Nodes.Add(node);
e.Node.Expanded = true;
}