I’d like to have a list that will shorten a field value if it is too long from a linked Entity Data Model. Something where I could take the following:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<MvcDR.Models.DONOR_LIST>>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<h2>Lists</h2>
<table>
<tr>
<th></th>
<th>LIST_NAME</th>
<th>SUMMARY</th>
</tr>
<% foreach (var item in Model) { %>
<tr>
<td><%: Html.ActionLink("Details", "Society", new { id = item.DONOR_LIST_ID })%> |</td>
<td><%: item.LIST_NAME %></td>
<td><%: item.SUMMARY%></td>
</tr>
<% } %>
</table>
and replace
<td><%: item.SUMMARY%></td>
with
<td><%: item.SHORT_SUMMARY%></td>
doing so in Ruby is pretty straight forward, but I am unsure of how to do so working within the Entity data model of asp.net mvc.
You could also do this with an extension method. I’m typing this from scratch, without benefit of an IDE, so please excuse any typos:
Then in your asp.net code: