从ASP代码后面将参数传递给Javascript函数

我有一个很长的过程,我想向用户显示一个进度条,我将参数(百分比)传递给我的带有母版页的Webform中的Javascript函数。

我有这个:

 function updateProgress(percentage) { document.getElementById('ProgressBar').style.width = percentage+"%"; }  

和:

 

在我的代码隐藏中,我将此参数传递给函数:

 // Report progress >> ~ 18% string updateProgress = "18"; ClientScript.RegisterStartupScript(this.GetType(), "updateProgress", "updateProgress('" + updateProgress + "');", true); 

当我运行代码时,进度条永远不会从0%移动。 我想继续通过使用新参数再次调用函数来更新代码后面的完成百分比,直到达到100%。

我已经浏览了论坛,但我无法看到我需要做些什么才能让它发挥作用。

有任何想法吗?

试试这种方式

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

脚本AS

   

ASPX页面