响应在此上下文中不可用。
protected void Page_Load(object sender, EventArgs e)
{
Thread ControlUpdata = new Thread(new ThreadStart(UpdataControl));
ControlUpdata.Start();
}
void UpdataControl()
{
Random R = new Random(); // Used to generate random sleep times
int currentValue, currentPercent; // used to know progression
int maxValue = 15; // Number of steps
for (currentValue = 1; currentValue <= maxValue; currentValue++)
{
int sleepTime = R.Next(300, 1000);
System.Threading.Thread.Sleep(sleepTime);
currentPercent = GetPercentage(currentValue, maxValue);
string jsBlock = "<script>setPgb('pgbMain', '" + currentPercent + "'); </script>";
Response.Write(jsBlock); //这里会提示错误?不知道怎么解决,请教大家
Response.Flush();
}
Response.Write("<script>setPgb('pgbMain', '100'); addLog('logMain', '<br/><br/><b>Done !</b>');</script>");
Response.Flush();
}