Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have developed an ASP.NET application. In it there is one message alert label. The problem is how to see the number of unread messages in the label control using local storage.

Thanks
Posted
Updated 25-Aug-13 7:28am
v2
Comments
SRK90 25-Aug-13 10:39am    
Can you tell me clearly....not sure what are you trying to tell .....
Mahesh_Bhosale 26-Aug-13 6:15am    
show unread message like facebook message
want to count unread message on user side using local storage.
SRK90 25-Aug-13 10:39am    
you mean, when the user login, he/she should able to see the number of unread messages in that label?
Mahesh_Bhosale 26-Aug-13 4:45am    
yes
Which unread messages? Please provide details and post some code as well.

First of all you should have a count of unread messages to show the user the number of unread messages; once you have got that count, you can simply display that count to the user. So, the easiest way to do is to have another column in your table of messages just to keep record for that message in case that message has been read or not; that column can be a simple boolean value. In case a user has read a message, the value against that message in database is set as true otherwise false. After that, you can get the count of all those messages where that boolean value is false and then you can display that count in that label.
 
Share this answer
 
(In Database)Create a row in the already existing table or create a new table for this...
have a primary key for each mail,(I hope that you already have that)....
have one row called "Message Status" in the table, whenever the mail has been recieved,
initially assign that "Message Status" value as 0(which means the message is yet to be read)
whenever the use clicks the respective message, update the "Message Status" as 1 (which means the mail has been read) likewise, whenever the user login, count the number of "Message Status" having 0 value and give that value in the respective label you need.
 
Share this answer
 
Comments
Mahesh_Bhosale 29-Aug-13 5:13am    
i don't want to use db, did you know how to use local storage??? if you know then tell me. Thanks
SRK90 31-Aug-13 9:08am    
http://msdn.microsoft.com/en-us/library/vstudio/ms233763.aspx

Plz check this and let me know :)

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