Home - Forums-.NET - FlyTreeView (ASP.NET) - FlyTreeView to HTML string

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

This forum related to following products: FlyTreeView for ASP.NET

FlyTreeView to HTML string
Link Posted: 07-Sep-2005 22:32
Hi all

Does anyone have an idea to make an html string from a flytreeview (or from a dataset ):
private string FTVtoHTMLstring(FlyTreeView ftv){}
or
private string FTVtoHTMLstring(DataSet ds){}


I'd like this method returns a string like that: (with indentation)

XXXXXX
__YYYYYYY1
____ZZZZZZ1
__YYYYYYY2
____ZZZZZZ2
____ZZZZZZ3
______######1
______ ######2
...

Maybe it's easier to use an xsl transform with this kind of xml source :



    
        
            
                
                
            
        
        
    


but I deplore that a ftv.WriteXml() has not been inserted in the dll.

Does anyone has even coded a method like that ?
Link Posted: 08-Sep-2005 03:06
A simple way, working:

public static string NodetoHTMLstring(string id , int level, string text )
    {  
      string str = "
";
      
      for(int i=0 ; i      {
        str += "__";
      }

      str += text + "
";      

      return str;      
    }


and how i call it

string s = "";
foreach(TreeNode tn in FlyTreeView1.GetCheckedNodes())
      {        
          s += NodetoHTMLstring( tn.Key , Convert.ToInt32(tn.Data) , tn.Text );
      }
Link Posted: 08-Sep-2005 19:22
Nice.
Thanks.