Mono Support HOW TO DISPLAY NOTIFICATIONS WHEN USER HAS UNREAD MESSAGES 

Viewed 67221 time(s), 20 post(s), 8/1/2014 7:00:34 PM - by ZaeVega
8/1/2014 7:00:34 PM
22 Reputation 2 Total posts

Hello everyone, I´m building a social plattform and my client wants to have visually displayed notifications when the users have unread messages, like facebook style, How can this be accomplished? 

Regards!

1
8/2/2014 11:07:20 AM
2793 Reputation 345 Total posts

I'd vote for that too ;-)

2
8/4/2014 9:56:23 AM
15993 Reputation 2214 Total posts

Hi,

we can provide you with few lines of code to get the counts and then you can display message counts on some control or page. Let us know if this is an option for you ?

BTW - we are working on new notification mechanism (Facebook like) that will have the counts displayed somewhere in the page, I hope this will be done for the v5.x release.

Regards

3
8/4/2014 3:54:55 PM
22 Reputation 2 Total posts

Hi Khorvat,
 I will really appreciate if you can provide me the code you talk about, certainly that could be an option for me.
Thanks and regards

4
8/8/2014 8:05:00 AM
3016 Reputation 428 Total posts

Hi Zaevega,

sorry for a delay, some one from our support team will get back to you today with code samples.

Regards.

5
8/8/2014 9:32:15 AM
3016 Reputation 428 Total posts

Hi,

you can add this code to your markup:

<asp:PlaceHolder runat="server" ID="plhNumber">
         <span class='number'><%= this.NumberOfUnreadMessages%></span>
</asp:PlaceHolder>
and create a property in your code behind:

/// <summary>
/// Gets Number of unread messages.
/// </summary>
public  string NumberOfUnreadMessages
{
    get
    {
            return MonoSoftware.MonoX.Repositories.MessageRepository.GetInstance().GetNumberOfUnreadMessages(SecurityUtility.GetUserId());
    }
}
Also, you will need to add some styling to your markup in order to style your count icon. Below is an example of css snippet:

.login-status-register .message-box .active-message .number {
    background-color: Red;
    font-size: 10px;
    font-weight: bold;
    height: 12px;
    line-height: 12px;
    margin: 0;
    padding: 0;
    position: absolute;
    right: 2px;
    text-align: center;
    top: 2px;
    vertical-align: middle;
    width: auto;
}
Regards.

6
8/19/2014 1:24:19 PM
2793 Reputation 345 Total posts

can you post a screenshot of how this looks on the UI?



also, instead of touching the codebehind, couldn't one do the following?
<asp:PlaceHolder runat="server" ID="plhNumber">
         <span class='number'><%= MonoSoftware.MonoX.Repositories.MessageRepository.GetInstance().GetNumberOfUnreadMessages(SecurityUtility.GetUserId()); %></span>
</asp:PlaceHolder>
in that case, what's the namespace where SecurityUtility class is?

7
8/20/2014 8:00:41 AM
3016 Reputation 428 Total posts

Hi, 

yes, you can do it in markup without need to change the code behind. SecurityUtility is in the following namespace:

MonoSoftware.MonoX.Utilities

8
8/25/2014 9:17:56 AM
2793 Reputation 345 Total posts

thanks, so it should be:



<asp:PlaceHolder runat="server" ID="plhNumber">
<span class='number'><%= MonoSoftware.MonoX.Repositories.MessageRepository.GetInstance().
GetNumberOfUnreadMessages(MonoSoftware.MonoX.Utilities.SecurityUtility.GetUserId()); %></
span>
</asp:PlaceHolder>

9
8/25/2014 7:04:41 AM
3016 Reputation 428 Total posts

Yes,

Regards.

10
1 2
This is a demo site for MonoX. Please visit Mono Software for more info.