且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

动态添加标签到aspx页面

更新时间:2023-12-05 08:47:46

在您的标签中

in your tags

Meta_Keywords="Rapid, guarding"
 Meta_Description="Security Services from Rapid Response Security Services, Auckland"
 Meta_Author="kingsland and mt eden rapid response security ltd"



我认为不是Meta_Keywords,可能是MetaKeywords.同样的方法也删除了Meta_Decription的下划线.取出整个Meta_Author标签.

您还没有提到.Net框架的哪个版本

改进的答案
----------------

在这种情况下,您需要remove the code blocks并在主页面的页面加载事件中添加来自代码后面的那些链接.

需要给头部一个id为<head runat="server" ID="HeadContent">.然后在母版页加载中使用此代码.

也使用此命名空间
using System.Web.UI.HtmlControls;



I think it is not Meta_Keywords It might be MetaKeywords. Same way remove that underscore for Meta_Decription as well. Take out the whole Meta_Author tag.

And you haven''s mentioned which version your .Net framework

Improved Answer
----------------

In that case you need to remove the code blocks and add those links from code behind in the main master''s page load event.

Need to give an id for the head section as <head runat="server" ID="HeadContent"> . Then in the master''s page load use this code.

Use this namespace as well
using System.Web.UI.HtmlControls;

HtmlLink CSSHtmlLink = new HtmlLink();
CSSHtmlLink.Attributes.Add("rel", "Stylesheet");
CSSHtmlLink.Attributes.Add("type", "text/css");
CSSHtmlLink.Attributes.Add("media", "all");
CSSHtmlLink.Attributes.Add("href", ResolveUrl("~/Styles/site.css"));
this.HeadContent.Controls.Add(CSSHtmlLink);


ScriptManager.RegisterClientScriptInclude(this.Page,this.GetType(),"script1", ResolveUrl("~/js/jquery-1.2.6.js"));
ScriptManager.RegisterClientScriptInclude(this.Page, this.GetType(), "script2", ResolveUrl("~/js/startstop-slider.js"));


,我正在使用.NET 3.5版本... Visual Studio 2008 Pro.
and I''m using .Net 3.5 version ...visual studio 2008 pro.