2

i want to get all notifications with signal R and i want to fill drop-down list with all notifications coming from database...i received all notifications but when i display on drop-down...all are not in proper format ..these all are just like a single notification...enter image description here

controller===>>>

 public ActionResult GetMessages()
        {
           MessagesRepository _messageRepository = new MessagesRepository();
            return PartialView("_MessagesList", _messageRepository.GetAllMessages());
        } 

View==>>>

 function getAllMessages()
               {
                   var tbl = $('#messagesTable');
                   $.ajax({
                       url: '/Home/GetMessages',
                       contentType: 'application/html ; charset:utf-8',
                       type: 'GET',
                       cache:'false',
                       dataType: 'html'
                   }).success(function (result) {

                       $.notiny({
                           text: 'New Notification Available You May Check',
                           animation_hide: 'custom-hide-animation 0.5s forwards'
                       });

                       tbl.empty().append(result);


                   }).error(function () {

                   });


               }
1
  • So what exactly does the _MessagesList partial return? Commented Jun 22, 2016 at 21:05

1 Answer 1

1

In your _Message view you should write your code in <table> tag... like this

_message==>>

<table>
    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Message)

                @Html.DisplayFor(modelItem => item.EmptyMessage)

            </td>
        </tr>


    }

</table>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.