Link to home
Get AccessLog in
Avatar of er_maverick
er_maverick

asked on

ASP.NET, IE 6.0

I have created a user control which is  reading nodes from xml and constructing a treeview control.I ave added tool tip property in the xml.It is setting the tooltip but its not displaying it.
Test.xml
<TreeView id="1">
      <Title>
        <lang name="ENG" val ="Make a Plan" ToolTip="This is tool tip"></lang>
        <lang name="RUS" val ="RUS_Make a Plan"></lang>
        <lang name="ZHO" val ="ZHO_Make a Plan"></lang>
        <lang name="SPA" val ="SPA_Make a Plan"></lang>
      </Title>
      <Link>
        <lang name="ENG" txt ="Marketing Communication Plan" URL="http://google.com" ToolTip="This is tool tip"></lang>
        <lang name="ZHO" txt ="ZHO_Marketing Communication Plan" URL="http://google.com"></lang>
        <lang name="RUS" txt ="RUS_Marketing Communication Plan" URL="http://google.com"></lang>
        <lang name="SPA" txt ="SPA_Marketing Communication Plan" URL="http://google.com"></lang>
      </Link>
      <Link>
        <lang name="ENG" txt ="Marketing Communication Plan Template" URL="http://google.com" ToolTip="This is tool tip"></lang>
        <lang name="ZHO" txt ="ZHO_Marketing Communication Plan Template" URL="http://google.com"></lang>
        <lang name="RUS" txt ="RUS_Marketing Communication Plan Template" URL="http://google.com"></lang>
        <lang name="SPA" txt ="SPA_Marketing Communication Plan Template" URL="http://google.com"></lang>
      </Link>
 
</TreeView>
 
 
Snippet from my user control sample.ascx.cs
 
TreeNode mainTitleNode = new TreeNode();
 
XmlNodeList lstlang = n.SelectNodes("./lang[@name='" + Lang + "']");
 
                    foreach (XmlNode nn in lstlang)
                    {
                        TreeNode txtNode;
                      
                            txtNode = new TreeNode("<a href=" + nn.Attributes["URL"].Value + ">" + nn.Attributes["txt"].Value + "</a>");
                            txtNode.ToolTip = nn.Attributes["ToolTip"].Value;
 
                            mainTitleNode.ChildNodes.Add(txtNode);
 
                       
 
                    }

Open in new window

Avatar of MuhammadAdil
MuhammadAdil
Flag of Pakistan image

Avatar of er_maverick
er_maverick

ASKER

Hi,
That solution is not working for me.Moreover Tooltip property is there.
example:
TreeNode txtNode=new TreeNode;
 txtNode.ToolTip = "Hello";
Wanted suggestion on how to render/display the tooltip.

cheers
Please check your code. I have create same type of senario. And Its Showing tool tip. Or Send me code let me check.

Regards,
Adil Fazal
Its not working for me.
I am attaching the POC.
Uesr control is sample.ascx which is having tree view control
XML file is test.xml
kindly check.
cheers
XML is
<?xml version="1.0" encoding="utf-8" ?>

 
   
   
   
   
       
 
 
   
     
     
     
     
   
   
     
     
     
     
   
   
     
     
     
     
   
   
     
     
     
     
   
   
     
     
     
     
   
 


   
     
     
     
     
   
   
     
       
       
       
       
     
     
       
       
       
       
     
     
       
       
       
       
     
     
       
       
       
       
     
     
       
       
       
       
     
   
 
 
   
     
     
     
     
   
   
     
       
       
       
       
     
     
       
       
       
       
     
     
       
       
       
       
     
     
       
       
       
       
     
     
       
       
       
       
     
   
 

 
 
Attaced xml with preious post.
Attaching Uesr control is sample.ascx which is having tree view control and Default.aspx which is uploading tree view conrolt

Sample.doc

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;

public partial class Sample : System.Web.UI.UserControl
{
    private string lang = "RUS";
    string treeXML;

    public string TreeXML
    {
        get { return treeXML; }
        set { treeXML = value; }
    }
    public string Lang
    {
        get { return lang; }
        set { lang = value; }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        XmlDocument doc = new XmlDocument();
        doc.LoadXml(TreeXML);

        int count = 1;
        XmlNodeList lstMain = doc.SelectNodes("./Tree/TreeView");
        Table tblTreeView = new Table();

        foreach (XmlNode main in lstMain)
        {
            Label mainHeading = new Label();
            mainHeading.ID = "label" + count;
            mainHeading.Text = doc.SelectSingleNode("./Tree/MainTitle[@id='" + count + "']/lang[@name='" + Lang + "']").Attributes["val"].Value;
            TableRow trLabel = new TableRow();
            TableCell tcLabel = new TableCell();
            tcLabel.Controls.Add(mainHeading);
            trLabel.Cells.Add(tcLabel);
            tblTreeView.Controls.Add(trLabel);
            TreeNode mainTitleNode = new TreeNode();
            TreeView tr1 = new TreeView();
            tr1.ID = "tr" + count;


            string strPath = "./Tree/TreeView[@id='" + count + "']/Link";
            string subTitle = doc.SelectSingleNode("./Tree/TreeView[@id='" + count + "']/Title/lang[@name='" + Lang + "']").Attributes["val"].Value;
            //string subTitle = "tset"+count;
            mainTitleNode.Text = subTitle;
            mainTitleNode.SelectAction = TreeNodeSelectAction.None;


            TreeNode rootNode = new TreeNode();


            XmlNodeList lst = doc.SelectNodes(strPath);

            foreach (XmlNode n in lst)
            {
                XmlNodeList lstlang = n.SelectNodes("./lang[@name='" + Lang + "']");

                foreach (XmlNode nn in lstlang)
                {
                    TreeNode txtNode;

                    txtNode = new TreeNode("" + nn.Attributes["txt"].Value + "");
                    txtNode.ToolTip = nn.Attributes["ToolTip"].Value;





                    mainTitleNode.ChildNodes.Add(txtNode);



                }

            }
            count++;
            tr1.Nodes.Add(mainTitleNode);
            TableRow tr = new TableRow();
            tr.ID = "tr" + count;
            TableCell tc = new TableCell();
            tc.ID = "tc" + count;
            tc.Controls.Add(tr1);
            tr.Cells.Add(tc);
            tblTreeView.Rows.Add(tr);

        }

        pl1.Controls.Add(tblTreeView);


    }

}
ASKER CERTIFIED SOLUTION
Avatar of MuhammadAdil
MuhammadAdil
Flag of Pakistan image

Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
Yep,in the anchor tag got to set .
 Solution Worked .
 Thanks