我用VS2005开发,在进入产品详细页面后,想让此页面的网页标题显示为此产品的名称,也就是说,不同的详细页面它们的网页标题都要动态显示,请大侠们提供一下思路????

解决方案 »

  1.   

                    for (int i = 0; i < this.Page.Header.Controls.Count; i++)
                    {
                        if (this.Page.Header.Controls[i].ToString() == "")
                        {
                            this.Page.Header.Controls.RemoveAt(i);
                            i--;
                        }
                        if (this.Page.Header.Controls[i].ToString() == "System.Web.UI.LiteralControl")
                        {
                            this.Page.Header.Controls.RemoveAt(i);
                            i--;
                        }
                    }
                    this.Page.Title = ds.Tables[0].Rows[0]["meat_Title"].ToString();
                    this.Page.Header.Controls.Add(new LiteralControl("<meta name=\"keywords\" content=\"  " + ds.Tables[0].Rows[0]["meat_KeyWords"].ToString()  + ", \" />"));
                    this.Page.Header.Controls.Add(new LiteralControl("<meta name=\"description\" content=\" " + ds.Tables[0].Rows[0]["meat_Description"].ToString()   + " \" />"));
                   
      

  2.   


    <title><%=Session["product_name"]%></title>
      

  3.   

    如果用js来赋值的话就是:document.title="产品标题"如果你不用ajax的话可能就用不到这个了,用这个也很好<title><%=Session["product_name"]%></title>
      

  4.   

    <title> <%=产品标题%> </title> 
      

  5.   

    <head id="Head1" runat="server">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题页</title>
    </head>
    page_load(..)
    {
       this.Head1.Title = "test";
    }
      

  6.   

    但是我用的是GRIDVIEW或datalist,请问列表页中如何取得session["product_name"]?
      

  7.   

    如果你是手动绑定的数据。。就肯定可以 用SESSION。。
    你要是用VS的数据源。。我就不知道了。
      

  8.   

    <title> <%=产品标题%> </title>