Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting the size of an image in an ASP.Net TreeView

How do you set the size of an image in an ASP.Net TreeView?

We tried to set the size like this but the images are showing in full size:

<asp:TreeView 
    runat="server"
    DataSourceID="KnowledgeAcademySiteMap">

    <RootNodeStyle ImageUrl="/Images/book.png" Height="32px" Width="32px" />
    <ParentNodeStyle ImageUrl="/Images/book.png" Height="32px" Width="32px" />
    <LeafNodeStyle ImageUrl="/Images/book.png" Height="32px" Width="32px" />
</asp:TreeView>
like image 679
Emad-ud-deen Avatar asked Oct 24 '25 18:10

Emad-ud-deen


1 Answers

That height and width is applied to the tree view node, not to the image, that explains why the image size doesn't change.

You can either:

  1. Change the size of the image using photoshop, .NET Paint etc or
  2. Apply a CSS style rule to the images contained in the tree view, example:

CSS:

.treeView img { width:32px; height:32px; }

ASPX:

<asp:TreeView CssClass="treeView" ...
like image 72
Denys Wessels Avatar answered Oct 27 '25 08:10

Denys Wessels