在2005无法解决的问题!
我想在母板页里面
<head runat= "server ">
<meta name= "description " content= " <%=Description %> " />
<meta name= "keywords " content= " <%=Keywords %> " />
</head>
其中Description和Keywords是定义的两个属性
运行后看代码上面的内容变成
<head runat= "server ">
<meta name= "description " content= "<%=Description %> " />
<meta name= "keywords " content= "<%=Keywords %> " />
</head>
如果把content=的 "去了的话
<head runat= "server ">
<meta name= "description " content= <%=Description %> />
<meta name= "keywords " content= <%=Keywords %> />
</head>
运行包错:控件包含代码块(即 <% ... %> ),因此无法修改控件集合。
已经一天了还没解决,各位兄弟帮帮忙呀!
------解决方案--------------------哪就用我第2个方法啊:
如果要用runat= "server ",就在 <head> 加个asp:literal控件,然后后台设置控件的text属性来设置description和keywords
see:
-----------------------
<head runat= "server ">
<asp:literal id= "ltKeywords " runat= "server "> </asp:literal>
</head>
.cs
ltKeywords.text = " <meta name=\ "keywords\ " content=\ "关键词\ " /> ";