Link to home
Create AccountLog in
Avatar of leap29
leap29Flag for Afghanistan

asked on

If the datalist is empty show a error message

I have a search funtion on my website that binds the results to a datalist.  Is it possible to count the results and if the results quals '0' write a error message such as 'No results found please try again' to the screen in a label perhaps??

Not really sure where to start with this one.

Avatar of Faizan Sarwar
Faizan Sarwar
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Yep as above but put a label or literal in place where you want the message to appear and then replace //your message above with YourLiteral.Text = "No results returned" or something simillar.
Do remember to set EnableViewState to false for this control though!
How do you bind your DataList?
this link might also provide you some insites