【问题标题】:Asp.net 4 TreeView SelectedNodeStyle ImageUrl seems to be ignoredAsp.net 4 TreeView SelectedNodeStyle ImageUrl 似乎被忽略了
【发布时间】:2014-10-24 21:23:04
【问题描述】:

我有以下代码,无论我尝试做什么,似乎 SelectedNodeStyle 上的 ImageUrl 都被忽略了。我是不是在倒退?

请注意,此线程是 ASP.Net TreeView with SiteMap is ignoring Node.Selected 的延续,它提出了一个不同的问题并揭示了这个新问题。

<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1">
    <NodeStyle ForeColor="White" Font-Bold="true" NodeSpacing="5"
        HorizontalPadding="5" ImageUrl="~/Images/Page.png" />
    <SelectedNodeStyle Font-Bold="true" NodeSpacing="5" 
        HorizontalPadding="5" ImageUrl="~/Images/Page_Hot.png"/>
    <HoverNodeStyle ForeColor="Navy" />
</asp:TreeView>

在上面的示例中,选定的节点下划线工作得很好。但是,图像永远不会改变。是的,我仔细检查了图像的名称是否正确。它会更改其他样式属性,而不是图像。很郁闷。

解决方案?

【问题讨论】:

  • 我想指出,在后面的代码中设置它可以正常工作。

标签: asp.net treeview imageurl


【解决方案1】:

这似乎是一个错误,可以追溯到几年前(~2005、2006)。 (请原谅链接填充的答案)

http://forums.asp.net/t/943367.aspx http://connect.microsoft.com/VisualStudio/feedback/details/104297/treeview-selectednodestyle-imageurl-not-working

我会改为在代码隐藏中设置它。

【讨论】:

  • 你的头像很有趣——有史以来最年轻的开发者!
猜你喜欢
  • 2021-10-28
  • 2016-09-30
  • 2012-03-11
  • 1970-01-01
  • 1970-01-01
  • 2017-12-05
  • 2012-03-08
  • 2015-12-11
  • 2014-04-15
相关资源
最近更新 更多