1
votes

I'm using DataBind() on an ASP.NET GridView, and it throws a ThreadingAbort exception, but only when the GridView is currently bound to an empty (but not null) DataTable and I call DataBind() after linking it to another empty (but not null) DataTable.

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

Any ideas why this should happen, and how to stop it? Thanks

1
bind it inside if(!IsPostBack). - 5377037
I don't think it is anything to do with IsPostBack - that is true for both attempts to .Bind(), but only the second attempt fails. - radders

1 Answers

0
votes

Found the problem. It was throwing an exception in the _OnDataBound(Object sender, EventArgs e) event handler.