I have a webgrid which displays the headers and group by box even if there is no data to display. How do I display a message 'Your search criteria have given no results.Please re-try with a different search criteria' when there is no data to display?
I believe the NoDataMessage property directly on the DisplayLayout settings may be helpful in your case, for example:
<igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server"> <DisplayLayout NoDataMessage="No Data Displayed"><igtbl:UltraWebGrid>
In the case where you want to hide the grid altogether (columns and everything), you can set the Visible property of the grid to false and display a label with custom message if the datasource has 0 rows.
Hope this helps.
I have tried using the NoDataMessage without any effect.I am using Sqldatasource .
Is there something similar to '<EmptyDataTemplate' (available in gridview)
in ultrawebgrid
As indicated elsewhere, the NoDataMessage only appears if not only no Rows but also no Columns exist. So if you can detect no Rows and then force no Columns, it works fine.
To do that, use the ultrawebgrid's PreRender event. There, just add one line of code:
If MyGrid.Rows.Count = 0 then MyGrid.Columns.Clear()