Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

Change Page title dynamically in asp.net using C#

Author: Zunnair
Download Source Code : 851_DynamicallyChangeTitle.zip

In this simple article you will learn to change title of web page dynamically.

 Create a web application in c#

Drag a button and one textbox on the form

Then write code on form load event

 

C#

protected void Page_Load(object sender, EventArgs e)

    {

        this.Title = "Page Default Title";

        Button1.Text = "Change Title of page";

 

    }

VB

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

        Me.Title = "Page Default Title"

        Button1.Text = "Change Title of page"

 

    End Sub

After that write some code on button click even

C#

protected void Button1_Click(object sender, EventArgs e)

    {

        this.Title = TextBox1.Text.Trim();

        Label1.Text = "Page title is changed to " + TextBox1.Text.Trim();

    }

VB

  Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)

        Me.Title = TextBox1.Text.Trim()

        Label1.Text = "Page title is changed to " + TextBox1.Text.Trim()

    End Sub

 

This is simple code to change title of page it is useful for indexing of your page in search engines.

Article Comments
This was a cool method!. Great ... I saw people trying to handle the same functionality using other methods. But this seemed to be simplest.

and do u know any methods to write metatag and keywords

Posted on 11/27/2009 4:40:02 AM by Hari

HI Hari,

Thanks for appreciation, and for meta tags and meta description see this article...

http://www.devasp.net/net/articles/display/852.html

It will solve your problem

and if you want to search some article from devasp.net you can search in google like "metatags + devasp" then you find all links related to meta tags in devasp

Thanks

Posted on 11/27/2009 4:47:39 AM by zunnair

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< Data Sets Types Understanding using Visual Studio 2005

Disclaimer - Privacy
© 2002-2017 DevASP.net