//Dynamically Generates the META tags consecutively for page ...
private void GenerateMetatags()
{
try
{
string str_country;
//If the there is no selected country OR the user clicks on select, then the default country that is set in Title is India ...
if (DropDownList_Country.SelectedItem == null || DropDownList_Country.SelectedItem.Text == "Select")
{
str_country = "India";
}
else
{
str_country = DropDownList_Country.SelectedItem.Text;
}
HtmlMeta hmKeyWords = new HtmlMeta();
HtmlHead head = (HtmlHead)Page.Header;
hmKeyWords.Name = "Keywords";
hmKeyWords.Content = "Home Loans - in " + str_country + ";
head.Controls.Add(hmKeyWords);
HtmlMeta hmDescription = new HtmlMeta();
hmDescription.Name = "Description";
hmDescription.Content = "Your Description ... about the site.";
head.Controls.Add(hmDescription);
HtmlTitle ht = new HtmlTitle();
ht.Text = "Home Loans in " + str_country + "";
head.Controls.Add(ht);
HtmlMeta httpequiv = new HtmlMeta();
httpequiv.HttpEquiv = "Content-Type";
httpequiv.Content = "text/html; charset=iso-8859-1";
head.Controls.Add(httpequiv);
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
}
-
ShriKrishna Bhardwaj , With ASP.Net, SQL Server, Javascript
No comments:
Post a Comment