首 页 ASP ASP.NET PHP JSP Ajax DIV+CSS JavaScript XML C#
MySQL MSSQL Access Oracle Linux Server 电脑技巧 网络安全 建站经验 其它

ASP.NET 2.0中动态修改页面标题

整理日期:2008年03月20日 【字体:


伊图教程网[www.etoow.com]
http://www.etoow.com/html/2008-03/1205973794.html
      End If
    End If
  End Sub

  Private Function GetPageTitleBasedOnSiteNavigation() As String
    If SiteMap.CurrentNode Is Nothing Then
      Throw New ArgumentException("currentNode cannot be Nothing")
    End If

    'We are visiting a page defined in the site map - build up the page title
    'based on the site map node's place in the hierarchy

    Dim output As String = String.Empty
    Dim currentNode As SiteMapNode = SiteMap.CurrentNode

    While currentNode IsNot Nothing
      If output.Length > 0 Then
        output = currentNode.Title & " :: " & output
      Else
        output = currentNode.Title
      End If

      currentNode = currentNode.ParentNode
    End While

    Return output
  End Function

  在上面的代码中,首先预定义了两个常量,然后逐步建立sitemap的结点,一开始结点是null的,然后再调用GetPageTitleBasedOnSiteNavigation() 这个过程,在每建立一个sitemap的结点时,用字符串进行连接,最后返回给page.title即可实现,当然也可以用递归实现。
Tags:
ASP.NET 2.0中动态修改页面标题
'http://www.etoow.com/html/2008-03/1205973794.html
1
 
信息搜索
  
联系我们关于本站广告服务设为首页 收藏本站友情链接网站地图
Copyright © Etoow.com Inc. All Rights Reserved