【问题标题】:DataBind throws ThreadingAbort exceptionDataBind 抛出 ThreadingAbort 异常
【发布时间】:2017-11-14 12:45:32
【问题描述】:

我在 ASP.NET GridView 上使用 DataBind(),它会引发 ThreadingAbort 异常,但仅当 GridView 当前绑定到空(但不为空)DataTable 和在将DataBind() 链接到另一个空(但不是空)DataTable 后,我调用它。

DataTable dt = ... // obtain DataTable with 0 rows
MyGridView.DataSource = dt;
MyGridView.DataBind(); // errors on second time around

任何想法为什么会发生这种情况,以及如何阻止它?谢谢

【问题讨论】:

  • 绑定到if(!IsPostBack).
  • 我认为这与 IsPostBack 没有任何关系 - 两次尝试 .Bind() 都是如此,但只有第二次尝试失败。

标签: asp.net gridview


【解决方案1】:

发现问题。 它在 _OnDataBound(Object sender, EventArgs e) 事件处理程序中引发了异常。

【讨论】:

    猜你喜欢
    • 2011-11-06
    • 2013-05-24
    • 2011-05-30
    • 1970-01-01
    • 2011-02-25
    • 2012-01-24
    • 1970-01-01
    相关资源
    最近更新 更多