|
|
|
You can use HtmlGenericControl() in ASP.Net pages to change the page title dynamically. All you have to do is, set an ID for the Html TITLE tag and make it "runat=server". Once you make it runat=server, you can access the control from the server side code and set any value for it. First lest create our test aspx page
Test1.aspx |
Now you have to declare a variable of type HtmlGenericControl and set the .InnerText property of that variable in you code behind file. This is all you have to dynamically set the page title (browser title) in your ASP.Net page.
Test1.aspx.vb |
Click here to copy the following block | Public Class Test1 Inherits System.Web.UI.Page
Protected pageTitle As System.Web.UI.HtmlControls.HtmlGenericControl
Private Sub Page_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load
PageTitle.InnerText = "Page Title - " & Now() End Sub End Class |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|