Skip to content Skip to sidebar Skip to footer

Pass Parameter To Javascript Function From Asp Code Behind

I have a long process and I want to show a user a progress bar where I pass a parameter (percentage) to a Javascript function in my Webform with masterpage. I have this:

Solution 1:

Try this way

string updateProgress = "18%";
    ClientScript.RegisterStartupScript(this.GetType(), "updateProgress", "updateProgress('" + updateProgress + "');", true);

Script AS

<scripttype="text/javascript">functionupdateProgress(percentage) {
        document.getElementById("ProgressBar").style.width = percentage;
    }
  </script>

ASPX page

<divclass="progress progress-striped active progress-success"style="height: 43px"><divid="ProgressBar"runat="server"class="progress-bar"role="progressbar"aria-valuemin="0"aria-valuemax="100"style="width: 0px;" ></div></div>

Post a Comment for "Pass Parameter To Javascript Function From Asp Code Behind"