Hi,
Did you put runat=server in body tag,like <body id=Body runat=server>
or you may initiate a class before you use it,
HtmlGenericControl body = new HtmlGenericControl("body");
--
Juno
MCSD.NET, MCDBA, MCSE
----------------------------------------------------------
Support Team of EasyDotNet, INC.
http://www.EasyDotNet.com
DataForm.NET - The most powerful data entry web server control for ASP.NET
"Shikari Shambu" <> wrote in message
news:...
> Hi,
> I have an ASP.NET website that has pages that inherit from a BasePage. I
> want all pages to have some common Javascript functions.
>
> I tried doing the following
>
> In the Base Page
> protected System.Web.UI.HtmlControls.HtmlGenericControl body;
>
> protected void Page_Load(object sender, System.EventArgs e)
>
> {
>
>
> body.Attributes.Add("onload","javascript:alert('He llo World')");
>
> }
>
> And, when I access the child page MyPage.aspx I get
>
> Object reference not set to an instance of an object.
>
> How do I add same javascript to the body onload tag of all my pages.
>
> TIA
>
>