It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Calling Javascript on page load

Calling Javascript on page load

Postby mellomel70 on Tue Aug 02, 2011 2:53 pm

Hi - I have an ASP.Net 2.5 application and I need to call a javascript function when one of the pages loads initially. I've tried:

Code: Select all
string ScriptToCall = @"EnableCheckboxes(" + cblDetails.ClientID + ", false);";
ClientScript.RegisterStartupScript(this.GetType(), "addScript", ScriptToCall, true);


where EnableCheckboxes is a javascript function on the page. This doesn't work (doesn't disable the CheckBoxList), although the EnableCheckboxes function DOES work when I call it in other ways, so I'm sure that the problem is that I'm not calling it properly on page load.

I've tried:

Code: Select all
ClientScript.RegisterStartupScript(this.GetType(), "addScript", "alert('Hello');", true);


which DOES work, so I know I'm on the right track, but how do I do this?

Thanks!
mellomel70
 
Posts: 3
Joined: Tue Aug 02, 2011 2:50 pm

Who is online

Users browsing this forum: No registered users and 3 guests