Implement the icon node (icon in the ASP. NET Treeview nodes) of the Treeview control in ASP. NET)

Source: Internet
Author: User
Customer's question:

Is there a way to add hover thumbnails to each item in a Treeview?

 

Public Treenode browseserver (treenode rootnode, String Path)
{
Directoryinfo di =   New Directoryinfo (PATH );
Directoryinfo [] dicollection = Di. getdirectories ();
Foreach (Directoryinfo de In Dicollection)
{
Treenode TN= NewTreenode (De. Name, De. fullname );
Rootnode. childnodes. Add (TN );
Browseserver (TN, De. fullname );
}
Fileinfo [] ficollection = Di. getfiles ();
Foreach (Fileinfo fe In Ficollection)
{
Treenode TN= NewTreenode (Fe. Name, Fe. fullname );
Rootnode. childnodes. Add (TN );
}
Return Rootnode;
}

Thanks in advance.

Answer:

HiDivided

I suggest you try the following way, hope this helps

Change your code:

Treenode Tn =NewTreenode (De. Name, De. fullname );
Rootnode. childnodes. Add (TN );

To the following code:

 

String strname = " <a onmouseover = " Showthepic (Control) " Onmouseout = " Hide (Control) > " ;
Strname + = De. Name;
Strname + = ""
Treenode TN =   New Treenode (strname, De. fullname );
Rootnode. childnodes. Add (TN );

 

To dynamically generate a tree, you must implement the serverCodeIn collaboration with client code, embedded HTML tag is a good choice

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.