You must Sign In to post a response.
  • Category: JQuery

    Calling a jquery function in .cs file not working

    Hi,

    i want to call 2 jquery function in .cs file like below on pageload event

    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "tripbind();", true);
    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "busbind();", true);

    problem is only the fistcommand will work.here only tripbind function will work

    and busbind will not work.

    if i change the order then busbind will only work

    i want to fire both commands .


    How to solve this


    Regards

    Baiju
  • #766542
    Please try like below :

    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "tripbind();", true);
    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script1", "busbind();", true);

    Regards,
    Sujit Kumar

  • #766543
    Hi,

    The script tag for registration should be unique, but in your case you are using same id for both the scripts that is the problem it runs only one script.

    Rechange your script file like below

    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script1", "tripbind();", true);
    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script2", "busbind();", true);


    pass different script tag for both the scripts.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #766546
    your code still not working

  • #766871

    System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "document.getElementById('" + button2.ClientID + "').style.display='none';", true);


    2nd method

    System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "yourJavascriptFunction1();", true);
    System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "yourJavascriptFunction2();", true);

    SRI RAMA PHANI BHUSHAN KAMBHAMPATI


Sign In to post your comments