Reputation: 9720
I have a tag <html>
in master page
<html xmlns="http://www.w3.org/1999/xhtml">
from another page that uses this master page I want to add one more attribute, finally I want to generate something like this:
<html xmlns="http://www.w3.org/1999/xhtml"
prefix="ya: http://webmaster.yandex.ru/vocabularies/">
Does anyone know how this can be accomplished ?
Upvotes: 1
Views: 137
Reputation: 33306
In your master set the tag to runat=server and give it an id like this:
<html lang="en" runat="server" id="masterHead">
In your masterpage .cs add this to set the property:
public string SetPrefix
{
set { masterHead.Attributes.Add("prefix", value); }
}
Then from your content page you can set it like this:
var master = Master as SiteMaster;
if (master != null)
((SiteMaster)Master).SetPrefix = "ya: http://webmaster.yandex.ru/vocabularies/";
In the above SiteMaster is your MasterPage, you may have to change it to the actual name of your MasterPage.
Upvotes: 2