我有一个网格,我以这种方式将数据绑定在Page_Load中:
List<ProductEventCheck> ruleset = (from s in (this.Page as BasePage).DbContext.ProductEventChecks
where s.Sequence != 0
orderby s.Sequence
select s).ToList<ProductEventCheck>();
rulesGrid.DataSource = ruleset;
rulesGrid.DataBind();
所以,我有3列Name,Descriptoin和status,其中name和description来自Database,而status依赖于storedprocedures run。基本上,Name字段是过程名称。所以,我有21个运行的存储过程。所以,我想运行一个计时器,以便我可以每3秒显示一次状态字段处理,但我写的代码只有在运行所有程序后才会刷新。你能不能帮助我知道我一直在做的问题或错误?
protected void Timer1_Tick(object sender, EventArgs e)
{
string proc = "";
int result = 0;
GridItemCollection gridRows = rulesGrid.Items;
foreach (GridDataItem data in gridRows)
{
proc = Convert.ToString(data["Name"].Text);
RunProcedure(proc, out result);
if (Convert.ToInt32(result) == 0)
{
data["statusResult"].Text = "Failure";
RadButtonContinue.Enabled = false;
break;
}
else
{
data["statusResult"].Text = "Completed";
continue;
}
}