簡體   English   中英

在asp.net的TreeView中的文字右側顯示圖像

[英]Display Image to right of text in TreeView in asp.net

我有一個TreeView彈出菜單。 當我默認將一個帶有圖像的新TreeNode添加到TreeView ,該圖像顯示在TreeNode文本的左側。

我的aspx代碼是

<asp:TreeView ID="TreeView1" runat="server" ImageSet="Arrows" ExpandDepth="1" NodeIndent="10"
        BackColor="White" Font-Bold="False" Font-Italic="False" Font-Names="Andalus"
        Font-Size="Small">
        <HoverNodeStyle Font-Underline="False" />
        <Nodes>
            <asp:TreeNode Text="Parent 1" Value="Print">
                <asp:TreeNode Text="Node 1" Value="01"></asp:TreeNode>
                <asp:TreeNode Text="Node 2" Value="02"></asp:TreeNode>
            </asp:TreeNode>
            <asp:TreeNode Text="Parent 2" Value="03"></asp:TreeNode>
            <asp:TreeNode Text="Parent 3" Value="04" ImageUrl="images/blinking_new.gif">
            </asp:TreeNode>                
            <asp:TreeNode Text="Parent 4" Value="05"></asp:TreeNode>
        </Nodes>
        <NodeStyle Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" HorizontalPadding="5px"
            NodeSpacing="0px" VerticalPadding="0px" />
        <ParentNodeStyle Font-Bold="True" ForeColor="#5555DD" />
        <SelectedNodeStyle Font-Underline="True" HorizontalPadding="0px" VerticalPadding="0px"
            BackColor="#FF99CC" ImageUrl="" />
    </asp:TreeView>

輸出是

在此處輸入圖片說明

但是我希望圖像應該出現在文本的右側。

喜歡:

在此處輸入圖片說明

這個怎么做 ? 是否有TreeNode任何屬性可以執行此操作,或者我必須為此編寫一個css 我也搜索了很多但無法解決。

您的寶貴建議將不勝感激。

你可以嘗試一下:

<asp:TreeNode Text="Parent 3" Value="04" ImageUrl="images/blinking_new.gif" class="new">
</asp:TreeNode>                

和你的CSS

.new image { 
    float: right; 
    /*try maybe also to use relative position*/
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM