Avatar of leap29
leap29
Flag 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.

.NET ProgrammingASP.NET

Avatar of undefined
Last Comment
Anurag Thakur

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Faizan Sarwar

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
daveamour

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!
prairiedog

How do you bind your DataList?
Anurag Thakur

this link might also provide you some insites
http://forums.asp.net/p/1077040/1584485.aspx
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes