更改站点地图中的标题不会显示在浏览器中 [英] Changing title in sitemap does not show up in browser

查看:60
本文介绍了更改站点地图中的标题不会显示在浏览器中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个标题为公司表格/标签的SiteMapNode,我想将其更改为公司表格/文件或仅公司。当我更改标题时,SiteMapNode不会显示在浏览器上.TatMapNode会自动隐藏。它不允许我更改为任何标题。

在我的本地主机上,从公司表格更改为公司工作,但它不适用于服务器。

任何帮助表示赞赏。

有谁能请帮帮我。

谢谢。



我有什么尝试过:



我尝试在代码隐藏文件中更改它,但仍然无效。

解决方案

如果你有MasterPage或者甚至你的代码有什么,都是未知的。由于您使用的是Sitemap,因此它具有title属性;例如下面的代码:



<?xml version =1.0encoding =utf-8?> 
< siteMap xmlns =http://schemas.microsoft.com/AspNet/SiteMap-File-1.0>
< siteMapNode url =〜/ Default.aspxtitle =Home>
< / siteMapNode>
< / siteMap>





如果你正在使用它但它仍然不起作用,那么你应该尝试一下使用Page类设置页面标题:

 protected void Page_Load(object sender,EventArgs e)
{
if(!Page.IsPostBack)
{
Page.Title =This Title;
}
}





最后,我发现了一篇很好的文章,讨论了不同的方式您可以设置页面标题,它甚至可以设置站点地图的标题:

https://www.asp.net / web的表单/概述/较老的版本,让-开始/主页/指定-的标题,元标签,和其他HTML的报头,在最母版页-CS


I have a SiteMapNode with title Company Forms/tab, which I want to change to Company Forms/Documents or just Company. When I change the title, that SiteMapNode does not show up on browser.That SiteMapNode automatically gets hidden. It does not allow me to change to any title.
On my localhost,changing from Company Forms to Company works but it does not work on Server.
Any help is appreciated.
Could anyone please help me with this.
Thank you.

What I have tried:

I tried changing it in the code behind file, but that still didn't work out.

解决方案

Unknown if you have a MasterPage or not or even what any of your code has. Since you are using the Sitemap, it does have the title attribute; such as the code below:

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



If you are using that and it still doesn't work, then you should probably try using the Page class to set the page title:

protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
		Page.Title = "This Title";
	    }
	}



And lastly, I came across a nice article that talks about all about the different ways you can set the page title and it even has a nice example of setting the title of the Sitemap:
https://www.asp.net/web-forms/overview/older-versions-getting-started/master-pages/specifying-the-title-meta-tags-and-other-html-headers-in-the-master-page-cs.


这篇关于更改站点地图中的标题不会显示在浏览器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆