Click here to Skip to main content
15,895,538 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to check datalist is empty. I want to display message in inbox using datalist. if user inbox is null then i want to display a message like "Sorry You have no message"
Posted

You can use

C++
datalist1.Items.Count


for that purpose.

For more details see this

http://forums.asp.net/t/1158965.aspx/1[^]
 
Share this answer
 
v2
Comments
thatraja 27-May-11 13:04pm    
Hi dude, please avoid txt speak(You instead of U). I'm sure you are so fast in your mobile while typing SMS, Cheers. :)
Sanjay J Patolia 28-May-11 3:12am    
Yes agreed 5
This may help you....
MIDL
if(dataList1.Items.Count > 0)
{
    // your code
}
else
{
    // give message to empty datalist....
}
 
Share this answer
 
Comments
Kim Togo 29-May-11 3:02am    
Nice and simple. My 5.
You can use templates(empty template) in the Datalist.

Handling Empty Data in an ASP.NET Repeater control[^]

Handling Empty Data in DataList control[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900