Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 348677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:23:14+00:00 2026-05-12T11:23:14+00:00

I’m trying to set up a messages view with asp.net mvc that will display

  • 0

I’m trying to set up a messages view with asp.net mvc that will display inbox, etc. What would be a nice tool to utilize for this implementation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:23:14+00:00Added an answer on May 12, 2026 at 11:23 am

    OK, here’s the guts of how we do it with jqGrid. The idea here is to show unread messages in bold, and with a preview of the body, like Outlook:

    jqGrid custom formatters (this syntax is for jqGrid 3.5; earlier versions are different:

    importanceFormatter: function(cellval, opts, action) {
        switch (cellval) {
            case -1:
                {
                    return '<img class="notificationImportanceIcon" alt="Low importance" title="Low importance" src="/Content/Images/lowimportance.png" />';
                }
            case 1:
                {
                    return '<img class="notificationImportanceIcon" alt="High importance" title="High importance" src="/Content/Images/highimportance.png" />';
                }
        }
        return cellval;
    },
    
    recipientFormatter: function(cellval, opts, action) {
        if (cellval) {
            var html;
            var i = 1;
            for (i in cellval) {
                if (i == 0) {
                    html = cellval[i];
                }
                else {
                    html = html + '; ' + cellval[i];
                }
            }
            return html;
        }
        return cellval;
    },
    
    messageFormatter: function(cellval, opts, action) {
        if (cellval) {
            var subject = '<span class="notificationSubject">' 
                + (cellval.Subject || "") + '</span>';
            var body = cellval.Body || "";
            var read = cellval.IsRead;
            var html;
            if ((body !== "") && (!read)) {
                var maxLength = 200;
                var excerpt = body.length > maxLength ?
                    body.substring(0, maxLength - 1) + "...." : body;
                html = subject + '<br /><span class="notificationBody" title="' 
                    + body + '" >' + excerpt + '</span>'
            }
            else {
                html = subject;
            }
            if (!read) {
                html = '<span class="unread">' + html + '</span>';
            }
            return html;
        }
    },
    

    CSS:

    td.unread span.notificationSubject
    {
        font-weight: bold;
    }
    
    td span.notificationBody
    {
        color: Blue;
        font-size: smaller;
    }
    
    #listTable tbody td
    {
        cursor: pointer;
        vertical-align: text-top;
    }
    
    .notificationHighImportance
    {
        color: Red;
        font-weight: bolder;
    }
    
    .notificationLowImportance
    {
        color:Blue;
    }
    
    img.notificationImportanceIcon
    {
        vertical-align: text-bottom;
    }
    
    td > img.notificationImportanceIcon
    {
        display: block;
    
        /* not sure why, but the following centers the image - taken from a W3C example */
        margin-left: auto;
        margin-right: auto;
    }
    

    Grid configuration:

    setupGrid: function(grid, pager, search) {
        grid.jqGrid({
            colNames: ['AltId', '', 'From', 'Subject', 'To', 'Received', 'Actions'],
    
            colModel: [
              { name: 'AltId', index: 'AltId', hidden: true },
              { name: 'Importance', index: 'Importance', width: 10, formatter: Vertex.Notification.List.importanceFormatter },
              { name: 'From', index: 'From', width: 50 },
              { name: 'NotificationMessage', index: 'Subject', width: 200, formatter: Vertex.Notification.List.messageFormatter, sortable: false },
              { name: 'Recipients', index: 'To', width: 50, formatter: Vertex.Notification.List.recipientFormatter, sortable: false },
              { name: 'Created', index: 'Created', width: 60, align: 'right', formatter: Vertex.UI.Grid.dateTimeFormatter },
              { name: 'ActionsAltId', index: 'ActionsAltId', width: 38, formatter: Vertex.UI.Grid.rowEditButtons, formatoptions: { buttons: { HideEdit: false} }, sortable: false }
            ],
            pager: pager,
            sortname: 'Created',
            sortorder: "desc"
        }).navGrid(pager, { edit: false, add: false, del: false, search: false });
        search.filterGrid(grid.attr("id"), {
            gridModel: false,
            filterModel: [{
                label: 'Search',
                name: 'search',
                stype: 'text'
                }]
            });
        }
    };
    

    LINQ to Entities:

        [AcceptVerbs(HttpVerbs.Get), CacheControl(HttpCacheability.NoCache)]
        public ActionResult ListGridData(JqGridRequest gridRequest)
        {
            var q = (from n in Repository.SelectAll()
                     from nr in n.NotificationRecipients
                     where nr.Recipient.UserName.Equals(
                         LoggedInUserName, StringComparison.InvariantCultureIgnoreCase)
                     orderby n.Created descending
                     select new PresentationModel
                     {
                         Id = n.Id,
                         AltId = n.AltId,
                         ActionsAltId = n.AltId,
                         Importance = n.Importance,
                         From = n.Creator.Person.DisplayName,
                         Created = n.Created,        
                         Subject = n.Subject, //used for search
                         Recipients =  from r in n.NotificationRecipients
                                       select r.Recipient.Person.DisplayName,
                         NotificationMessage = new NotificationMessage
                         {
                             Body = n.Body,
                             Subject = n.Subject,
                             IsRead = nr.MarkedAsRead /*IsRead for current user*/ 
                         }
                     }).ToList().AsQueryable();
           return Json(q.ToJqGridData(
               gridRequest.ToGridPageDescriptor(new [] {"From", "Subject"})));
        }
    

    You can find my series of articles on using jqGrid with ASP.NET MVC on my blog.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I would like to count the length of a string with PHP. The string
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.