Search code examples
javascriptasp.netdom-eventspageload

Call Javascript function in Page load event?


I'm using ASP.NET 4. C#. Is there anyway to call a Javascript function or button click event in Page Load?


Solution

  • you can use startup script with JavaScript or jquery

    string script = "$(document).ready(function() {$('button').trigger('click'); });";
    ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);