今天跟了一天的程序,直到4点多,还没搞定一个BUG,很是郁闷,看了一会新闻,最后一刻,终于搞定了.问题是:checkResult = checkCOShiptoValidate(e, coNo, shiptoNo, thisShipto, out alertResult);代码总是报错,先是跟进去看,但是太复杂了,并且,每次重现这个错误都要好长时间,最后,发现,出错后,点击IE上的BACK按钮,就没错了,于是想出了这个方法:如果出错,就把页面刷新一下,
dg_shipmentList.CurrentPageIndex = 0;
bindGrid();
这二句是Page_Load里面的
if(!IsPostBack)
{
this.dg_shipmentList.CurrentPageIndex = 0;
bindGrid();
}
所以单独提出来.
try
{
checkResult = checkCOShiptoValidate(e, coNo, shiptoNo, thisShipto, out alertResult);
}
catch
{
Page_Load(null,null);
dg_shipmentList.CurrentPageIndex = 0;
bindGrid();
checkResult = checkCOShiptoValidate(e, coNo, shiptoNo, thisShipto, out alertResult);
}
{
checkResult = checkCOShiptoValidate(e, coNo, shiptoNo, thisShipto, out alertResult);
}
catch
{
Page_Load(null,null);
dg_shipmentList.CurrentPageIndex = 0;
bindGrid();
checkResult = checkCOShiptoValidate(e, coNo, shiptoNo, thisShipto, out alertResult);
}