【问题标题】:asp.net treeview not rendering custom expand and collapse imagesasp.net treeview 不呈现自定义展开和折叠图像
【发布时间】:2011-03-09 14:47:52
【问题描述】:

我在 Updatepanel 中有一个 Treeview,目前我正在开发服务器上直接开发,并与它建立远程连接。我已经设置了 CollapseImageUrl 和 ExpandImageUrl 属性,当我在开发服务器的浏览器上查看它时,它呈现得很好。

它产生:

<td><a id="tvPartyRolesn0" href="javascript:TreeView_ToggleNode(tvPartyRoles_Data,0,tvPartyRolesn0,' ',tvPartyRolesn0Nodes)"><img src="Images/expanded.gif" alt="Expand EUGEN MAY(0)" style="border-width:0;" /></a></td><td style="white-space:nowrap;"><a class="tvPartyRoles_0" href="javascript:__doPostBack('tvPartyRoles','s419f4890-31ef-4216-a518-e8faabe24349')" onclick="TreeView_SelectNode(tvPartyRoles_Data, this,'tvPartyRolest0');" id="tvPartyRolest0">EUGEN MAY(0)</a></td>

但是,当我从本地电脑(相同的 url,完全相同的浏览器:IE 8)查看它时,它不会呈现展开图像并且生成的 html 是不同的:

<td><img src="/WebResource.axd?d=NqoU8iloxnxrlj-ZMUKCyamdjzSBKRr3z953sczo15w8GlcBeb28IywRWdNJp1sMt7Amde05goEj7xS55cTJgC-vUieKdef5bZnLtb6RuEJoxUlM0&amp;t=634208849469717278" alt="" /></td><td style="white-space:nowrap;"><a class="tvPartyRoles_0" href="javascript:__doPostBack('tvPartyRoles','s419f4890-31ef-4216-a518-e8faabe24349')" onclick="TreeView_SelectNode(tvPartyRoles_Data, this,'tvPartyRolest0');" id="tvPartyRolest0">EUGEN MAY(0)</a></td>

任何想法为什么会发生这种情况?

【问题讨论】:

    标签: c# asp.net treeview updatepanel


    【解决方案1】:

    它可能是前导 /,您是从本地计算机上的虚拟目录中查看它吗?

    如果您正在运行http://localhost/Project,那么 / 将导致树视图在应该查看 http://localhost/Project/WebResource.axd 时查找 http://localhost/WebResource.axd 处的图像

    【讨论】:

    • 嗨,不,我不是从虚拟目录查看的。我将路径指定为“~/Images/minimised.gif”和“~/Images/expanded.gif”。当我删除前导 / 它也停止在开发机器上工作。
    • 还有其他 asp:Image 控件引用与树视图相同的图像文件夹中的图像,从我的本地计算机查找和呈现它没有问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-18
    • 1970-01-01
    相关资源
    最近更新 更多