The ListingView renders the list of projects. There are a few different titles and the labels that can be customized.
CopyC#
<asp:Content ID="Content3" ContentPlaceHolderID="ListingView" runat="server"> <% var listModel = Model as ListingFolioModuleWrapper; if (listModel != null) { string title = "My Projects: {0}"; string subTitle = ""; if (Model.Mode == FolioModuleMode.Normal) { if (Model.CurrentCategory != null && Model.CurrentCategory.ID != "") subTitle = Model.CurrentCategory.Name; else subTitle = "All Projects"; } else { subTitle = Enum.Format(typeof(FolioModuleMode), Model.Mode, "G"); if (Model.ItemType != null && Model.ItemType.Name != "") { subTitle += " - " + Model.ItemType.Name; } } title = string.Format(title, subTitle); Type itemType = typeof(Cartella.Classes.Project); List<ButtonWrapper> buttons = new List<ButtonWrapper>(); if (Model.CanCreate && listModel.Mode != FolioModuleMode.Trash) { buttons.Add(new ButtonWrapper() { DisplayDiv = false, Label = "Create New Project", Url = Url.Action("Create", "FolioItem", new { ItemType = itemType.Name }) }); } ////////////////////////////////////////////////////////// /// Render list view box ////////////////////////////////////////////////////////// ViewDataDictionary data = new ViewDataDictionary(); data.Add(new KeyValuePair<string, object>("Title", title)); ViewInformation listBox = new ViewInformation("BoxDisplay", data, buttons.ToArray()); ViewInformation list = new ViewInformation("BoxListView", listModel.DisplayItems); listBox.AddChildView(list); Html.CartellaRenderNested(listBox); ////////////////////////////////////////////////////////// /// Render list view box end ////////////////////////////////////////////////////////// } %> </asp:Content>
Caution |
---|
The BoxListView view will call a list item view. This view must be located in the "ListItem" folder and have a name begining with "ListItem_". The next step in this tutorial will assume that you are using the code above and are calling the BoxListView View. |
Create the ListItem_Project View
In the "Shared" folder create a folder called "ListItem". In this folder create a new view called "ListItem_Project"
Fill in the genererated code file to look like this:
CopyC#
<%@ Import Namespace="Cartella.Models" %> <%@ Import Namespace="Cartella.Models.Wrappers" %> <%@ Import Namespace="Cartella.Models.EditForm" %> <%@ Import Namespace="Cartella.Classes" %> <%@ Import Namespace="Cartella.Interfaces" %> <%@ Import Namespace="Cartella.Support" %> <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Custom/Masters/ListItem/_ListItem_FolioItemBase.Master" Inherits="System.Web.Mvc.ViewPage<Cartella.Models.FolioItemWrapper>" %> <asp:Content ID="Content1" ContentPlaceHolderID="FolioItemCustom" runat="server"> <% Project proj = Model.FolioItem as Project; %> <span><%=proj.Description %></span><br /> <span>StartDate: <%=proj.StartDate.ToLongDateString() %></span><br /> <span>End Date: <%=proj.ProjectedEndDate.ToLongDateString() %></span><br /> <span>Actual End Date: <%=proj.ActualEndDate.ToLongDateString() %></span><br /> <span>Status: <%=proj.CurrentStatus.ToString() %></span><br /> </asp:Content>