gpt4 book ai didi

asp.net - 如何使用站点地图数据源在 asp.net 菜单中制作向下箭头?

转载 作者:太空宇宙 更新时间:2023-11-04 00:26:22 25 4
gpt4 key购买 nike

我在 asp.net 中的菜单显示在右上角,但我希望它向下。这是我网站的网址http://www.theucreate.com/default.aspx
在我们的工作菜单中,它显示右侧的箭头而不是向下的箭头。

CSS Code :
.menuItem
{
border:Outset 1px black;
background-color:Gray;
font:14px Arial;
color:White;
padding:3px;
position:relative;
z-index: 9999;
width:125px;
text-align:center;


}

菜单代码:

                            <asp:SiteMapDataSource ID="srcSiteMap" Runat="server" ShowStartingNode="false" />

站点地图代码:

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode
url="~/Default.aspx"
title="Home"
description="The home page of the Website">

<!-- SiteMapPath Nodes -->
<siteMapNode
title="Home"
description="Home">

</siteMapNode>

<!-- Menu Nodes -->
<siteMapNode
title="What we do"
description="Group of companies">
<siteMapNode
url="~/UsingMenu/MenuSiteMap.aspx"
title="ADMG logo"
description="Abu Dhabi Marketing Group" />
<siteMapNode
url="~/UsingMenu/MenuSiteMap.aspx111"
title="JamalMedia Logo"
description="Jamal Media" />
<siteMapNode
url="Images/images/Emirates Palace.jpg"
title="AFKARsoft Logo"
description="AFKARsoft"/>
</siteMapNode>

<!-- TreeView Nodes -->
<siteMapNode
title="Portfolio"
url=""
description="">

</siteMapNode>

<siteMapNode
title="Download"
description="">

</siteMapNode>

<siteMapNode
title="News Blog"
description="">

</siteMapNode>


<siteMapNode
title="About Us"
description="">

</siteMapNode>
<siteMapNode
title="Awards"
description="">

</siteMapNode>


<siteMapNode
title="Contact Us"
description="">

</siteMapNode>

</siteMapNode>

</siteMap>

最佳答案

这是该图像的 Firebug 结果。

<img style="border-style:none;vertical-align:middle;" alt="Expand What we do" src="/WebResource.axd?d=dwnZhK7b4PUDsKPTU3AZnUtITQ9KjzrPTvWdHZ0MJ5F90CTN6V8nGd5pgOYaON4YzxrLgw8Gv5od1SOfZnP5XQ_U_OV-qIXKJzrb0MKwjSo1&amp;t=634395197491956634">

我用谷歌搜索了这个问题,我找到了一个博客,它有类似的情况,可能会帮助他的代码解决你的问题。

protected void _siteMenu_ItemDataBound(object sender, System.Web.UI.WebControls.MenuEventArgs e)

{

// Reference the underlying SiteMapNode object...
MenuItem item = (MenuItem)e.Item;
SiteMapNode nodeFromSiteMap = (SiteMapNode)e.Item.DataItem;

string onImage = "";
string offImage = "";
string navUrl = "";

// If we have an imageUrl value, assign it to the menu node's ImageUrl property
if (nodeFromSiteMap["imageUrl"] != null)
{
onImage = System.Web.HttpContext.Current.Request.ApplicationPath + System.IO.Path.Combine("/Images/Elements/", nodeFromSiteMap["imageUrl"]);
offImage = System.Web.HttpContext.Current.Request.ApplicationPath + System.IO.Path.Combine("/Images/Elements/", nodeFromSiteMap["altImageUrl"]);
}
navUrl = nodeFromSiteMap["url"];

// These objects are necessary in order to capture the image object into a rendered html format
string src = offImage;
string toolTip = "";
System.Text.StringBuilder sb = new System.Text.StringBuilder();
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter htmWriter = new HtmlTextWriter(sw);
HtmlImage image = new HtmlImage();

image.Style.Add("border-style", "none");
MenuItem theMenuButton = new MenuItem();
theMenuButton.NavigateUrl = navUrl;
image.Src = src;

if (onImage != "" && onImage != null)
image.Attributes["onMouseOver"] = "this.src='" + onImage + "';";
if (onImage != "" && onImage != null)
image.Attributes["onMouseDown"] = "this.src='" + onImage + "';";
image.Attributes["onMouseOut"] = "this.src='" + offImage + "';";
image.RenderControl(htmWriter);
item.Text = sw.ToString();
}

Adding mouse over image in asp.net menu control add custom icon to specific menu item

关于asp.net - 如何使用站点地图数据源在 asp.net 菜单中制作向下箭头?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6624099/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com