Are you saying that you want to group the messages by date?
MessageList.DataSource = directChatWindow.messages.GroupBy(o => o.ts.Date, (key, items) => new
{
Date = key,
Messages = items.OrderBy(o => o.ts)
});
MessageList.DataBind();
<asp:ListView runat="server" ID="MessageList">
<ItemTemplate>
<h3><span><%#: Eval("Date", "{0:MMMM d, yyyy}") %></span></h3>
<ul class="list-unstyled msglist">
<asp:ListView runat="server" DataSource='<%# Eval("Messages") %>'>
<ItemTemplate>
<li>
<div class="media">
<div class="media-left">
<a href="javascript:void(0);">
<img src="../Content/images/1.png" alt="chat-avatar" />
</a>
</div>
<div class="media-body">
<h4 class="media-heading">
<a href="javascript:void(0);"><%#: Eval("name") %></a>
<%#: Eval("ts", "{0:hh:mm tt}") %>
</h4>
<p><%#: Eval("msg") %></p>
</div>
</div>
</li>
</ItemTemplate>
</asp:ListView>
</ul>
</ItemTemplate>
</asp:ListView>