0

Can I use AjaxControlToolkit to check whether ASP.NET GridView is Empty or Not?

Rauf
  • 12,326
  • 20
  • 77
  • 126

1 Answers1

0

An empty GridView control still renders its EmptyDataTemplate (or its EmptyDataText), so you can't just check if its associated <table> element is empty.

You might want to specify a custom EmptyDataTemplate that renders an element with a well-known id, then use $get() on the client-side to check if that element exists.

You can also create an extender on the GridView that passes its Rows.Count property to the client side using an ExtenderControlProperty.

Frédéric Hamidi
  • 258,201
  • 41
  • 486
  • 479
  • Is it wise to keep an hidden field, which will be set to RowCount in DataBound event ?. Then check the value using JavaScript. – Rauf Nov 01 '10 at 09:14