asp.net mvc 4 - How display the last n of records in MVC -


i taking last 4 four comments , want display in tooltip, doing below code showing contents "system.collection.generic.list"

var list = db.po_prd_comments.where(t => t.po_trgcal_id == item.id && t.reply == false).orderbydescending(t => t.po_trgcal_id).take(4).tolist(); list<string> comments = new list<string>(); if (list.count != 0) {     foreach (var ts in list)     {         comments.add(ts.prdcomment);         if (list.count == 1)         {             notify = list.singleordefault().notify;         }         else         {             notify = true;         }                                           }                                                   }   <td>     <a href="#" onclick="popup4(@countid)" title="@comments"     <img src="~/images/comment.gif"/></a> </td> 

how display these 4 comments in tooltip.

comments list of string. need convert single string , use title property value.

<a href="#" onclick="popup4(@countid)" title="@string.join(environment.newline,comments)">      <img src="~/images/comment.gif"/> </a> 

Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -