使用ASP.NET中的本地存储在标签控件中显示未读消息 [英] Show unread messages in the label control using local storage in ASP.NET

查看:74
本文介绍了使用ASP.NET中的本地存储在标签控件中显示未读消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个ASP.NET应用程序。其中有一个消息警报标签。问题是如何使用本地存储查看标签控件中未读消息的数量。



谢谢

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

推荐答案

首先,您应该有一些未读消息,以向用户显示未读消息的数量;一旦计算完毕,您就可以向用户显示该计数。因此,最简单的方法是在消息表中添加另一列,以便在已读取消息的情况下保留该消息的记录;该列可以是一个简单的布尔值。如果用户已读取消息,则数据库中针对该消息的值将设置为true,否则为false。之后,您可以获取布尔值为false的所有消息的计数,然后您可以在该标签中显示该计数。
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.


(在数据库中)在已经创建一行现有的表或为此创建一个新表...

每个邮件都有一个主键,(我希望你已经有了)....

有表中的一行称为消息状态,每当收到邮件时,

最初将消息状态值指定为0(这意味着消息尚未被读取)
每当用户点击相应的消息时,同样地将消息状态更新为1(这意味着已经读取了邮件),每当用户登录时,计算具有0值的消息状态的数量并给出您需要的相应标签中的值。
(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.


这篇关于使用ASP.NET中的本地存储在标签控件中显示未读消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆