How to display a notice when there is nothing to display

Hi Experts

I have created a site that uses data within an Access database and everything is working just fine.

But something that ran across my mind (I really must get out more) is what happens if there isn't any data to display? How would I inform the user that there are no records to display?

I would like to put something along the lines of "Sorry. There are no records that meet your request".

How would I do this?

Many thanks in advance.

Regards

Martin
LVL 1
Martin CotterillDabblerAsked:
Who is Participating?
 
Jason C. LevineConnect With a Mentor No oneCommented:
Hi Martin,

This is what the Show Region server behavior is used for.  Simply write whatever text you want to display if there is no data and highlight it.  Then go to the Applications Panel, Server Behaviors tab, and add Show Region -> If recordset is empty.

You should also select all other text on the page that should display if there IS data and use the Show Region -> If recordset is not empty on it.  This way, the page will hide all of the "normal" text when there is no data.
0
 
Martin CotterillDabblerAuthor Commented:
Excellent J!

Works perfectly!

Many thanks!

Regards

Martin
0
 
Jason C. LevineNo oneCommented:
Thanks Martin,

You should also examine the code the DW uses to create these "Show If" regions.  It's very simple and once you get the hang of it, you can use the same or similar syntax to create more complicated conditional regions.  I use this trick to show or hide areas based on certain values in the record being viewed, set CSS options based on database values, and more.  
0
 
Martin CotterillDabblerAuthor Commented:
Thanks for the tip J, I'll certainly do that.

Martin
0
All Courses

From novice to tech pro — start learning today.