这个问题是自定义命令引起的,偶尔会发生。自定义命令我用了二种方式,“提交保存”命令是通过javascript调用的,在javascrpit中执行命令document.getElementById('FpSpread1').Update();时出错
protected override void Render(HtmlTextWriter writer)
{
Table table = FpSpread1.FindControl("cmdTable") as Table;
if (table == null)
{
base.Render(writer);
return;
}
//提交命令
TableCell cell1 = new TableCell();
//前端执行--保存
ImageButton btn1 = new ImageButton();
btn1.ImageUrl = "../../../Images/save.gif";
btn1.ToolTip = "提交保存";
btn1.Attributes.Add("OnClick", "onSaveClick();");
//btn1.Attributes.Add("onclick", ClientScript.GetPostBackEventReference(FpSpread1, "BtnCommand,-1,-1") + "; return false;");
cell1.Controls.Add(btn1);
//后端执行--导出
ImageButton btn2 = new ImageButton();
btn2.ImageUrl = "../../../images/excel.gif";
btn2.ToolTip = "导出电子表";
//btn2.Attributes.Add("OnClick", "onExcelClick()");
btn2.Attributes.Add("onclick", ClientScript.GetPostBackEventReference(FpSpread1, "BtnCommand,-2,-1") + "; return false;");
cell1.Controls.Add(btn2);
//删除
ImageButton btn3 = new ImageButton();
btn3.ImageUrl = "../../../images/delete.gif";
btn3.ToolTip = "删除并重新生成当前报表";
btn3.Attributes.Add("onclick", ClientScript.GetPostBackEventReference(FpSpread1, "BtnCommand,-3,-1") + "; return false;");
cell1.Controls.Add(btn3);
//公式标注
ImageButton btn4 = new ImageButton();
btn4.ImageUrl = "../../../images/edit.gif";
btn4.ToolTip = "标注(取消)报表中的计算公式";
btn4.Attributes.Add("onclick", ClientScript.GetPostBackEventReference(FpSpread1, "BtnCommand,-4,-1") + "; return false;");
cell1.Controls.Add(btn4);
table.Rows[0].Cells.Add(cell1);
base.Render(writer);
} |