开发者

ASP.NET [How to check if SqlDataSource1 is empty]

I make SqlDataSource1.DataBind(); with some parameters on button click,

then I'm working with a Grid onDataBound();

but if my SqlDataSource1 returns empty data I've got an error even if 开发者_JS百科I'm trying to check if (GridView2.HeaderRow.Cells.Count != 0) so I guess I need to check it on SqlDataSource1 someway.

Question : How ?

Thank you.


GridView2.HeaderRow is null when when the data source is null so you could try checking if GridView2.HeaderRow = null


I would check GridView2.Rows.Count instead. Maybe there are no HeaderRow cells when the data source is empty.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜