Thursday, July 16, 2009

Dynamically set Pagetitle,meta tags

when master page has "head content place holder"
then each page has head content place holder

then use this code:

Page.Header.Title = "Houses to rent in Birmingham, Student accommodation ";

HtmlMeta tagDescription = new HtmlMeta();
tagDescription.Name = "Description";
tagDescription.Content = "EzeeHOME ";
Header.Controls.Add(tagDescription);

HtmlMeta tagKeywords = new HtmlMeta();
tagKeywords.Name = "Keywords";
tagKeywords.Content = "Student ";
Header.Controls.Add(tagKeywords);