请教:我在数据库里定义了一个基本的字段为网站的名称。然后我想每个网页里都调用这个名称给<title>。应该怎么给title赋值呢?谢谢!如果还是以前的asp方式是不行的。

解决方案 »

  1.   

    <title id="mytitle" runat="server"></title>protected HtmlGenericControll mytitle;
    ...mytitle.InnerText = "Whatever";or create a public property, saypublic string MyTitle {..}<title><%=MyTitle%></title>or you could create a base Page class and output some javascript:
    Page.RegisterStartupScript("StartUp", "<script> document.title = '" + YourTitleHere + "';</script>");
      

  2.   

    HtmlGenericControl类http://dotnet.aspx.cc/ShowDetail.aspx?id=091502D4-CD3B-4463-A1CF-14A36602FF6A