Search

Friday, February 7, 2014
0 comments

How to generate dynamic page title in ASP.NET

1:01 AMFriday, February 7, 2014
Page control provides page parameters, such as title, metaDescription etc. You can access all the parameters using Page Control in code file. First Check page URL on Page_Load method using Request object. Lets take an simple example

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       
        if (Page.Request .Url.ToString () =="http://localhost:11596/WebSite13/Default.aspx")
        {
            Page.Title = "Welcome to dotprogramming";
            Page.MetaDescription = " Its Cover all programming language";
            Response.Write("<h2>Dynamic Page title </h2>");


        }
    }
}

The code generate the following output

How to generate dynamic page title in ASP.NET

How to generate dynamic page title in ASP.NET

Protected by Copyscape Online Copyright Protection Software

0 comments :

Post a Comment

 
Toggle Footer
Top