Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IListSource does not contain any data sources

So what does this exactly means?

Some advised that to circumvent around this error, only bind a gridview to a dataset when the rows count of the datatable is greater than zero.

but how about if for example your search yielded no record returned, so your datatable would have no rows, but still, you can still bind to the dataset?

Aside from checking if rows are in the dataset (or datatable), how would I ensure that the ilist contains valid datasource?

what's the best method for this?

like image 240
Batuta Avatar asked Dec 06 '25 05:12

Batuta


1 Answers

Make sure you use this:

if (!this.IsPostBack)
{
}

Also you can check the dataSet.Tables.Count > 0 then return dataSet else return null;

I think the DataSet return have Count = 0

like image 92
DevMania Avatar answered Dec 07 '25 21:12

DevMania



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!