Hi,
I wanted to certain script to run in the onload of the body for my content page.
To do this we need to do the following
Add an id and runat attribute to the body tag in the MASTER page
<body id=”body” runat=”server”>
And in the Content page’s page load handler
protected void Page_Load(object sender, EventArgs e)
{
HtmlGenericControl body = this.Master.FindControl(“body”) as HtmlGenericControl;
body.Attributes.Add(“onLoad”, “alert(‘Hello World’);”);
}
Bye…
sir realy a good idea
LikeLike
Thanks for the solution that I have been searching till the morning!!! 😀 You’r great!!!
LikeLike
I want to access my javascript throu an onload event of an asp.textbox control, is it possible
LikeLike
Muchísimas Gracias!!!!!!!!!
LikeLike
thanks… good!!!
LikeLike