Asp.net 4 TreeView SelectedNodeStyle ImageUrl 似乎被忽略
我有以下代码,无论我尝试做什么,似乎 SelectedNodeStyle 上的 ImageUrl 都会被忽略。我是不是在做一些本末倒置的事情?
请注意,此线程是 ASP.带有 SiteMap 的 Net TreeView 忽略了 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>
在上面的示例中,所选节点下划线效果非常好。然而,形象永远不会改变。是的,我仔细检查了图像的命名是否正确。它改变了其他样式属性,但不改变图像。相当令人沮丧。
解决方案?
I have the following code and no matter what I try to do, it seems the ImageUrl on the SelectedNodeStyle is ignored. Am I doing something backwards?
Note that this thread is a continuation of ASP.Net TreeView with SiteMap is ignoring Node.Selected which asked a different question and revealed this new question.
<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>
In the sample above, the selected node underlining works just perfectly. However, the image never changes. Yes, I double-checked the image was named correctly. It changes the other style attributes, just not the image. Quite frustrating.
Solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎是一个错误,可以追溯到几年前(~2005、2006)。 (请原谅链接填充的答案)
http://forums.asp.net/t/943367.aspx
http://connect.microsoft.com/VisualStudio /feedback/details/104297/treeview-selectednodestyle-imageurl-not-working
我会在代码隐藏中设置它。
This seems to be a bug and goes back a few years (~2005, 2006). (Excuse the link-filled answer)
http://forums.asp.net/t/943367.aspx
http://connect.microsoft.com/VisualStudio/feedback/details/104297/treeview-selectednodestyle-imageurl-not-working
I would set it in code-behind instead.