Partition Web Apps Intelligently: C#: Create the Contact List Screen: Listing 1

This is the complete mark up for the contact list screen.

<%@ Page Title="Contacts" Language="C#" 
    MasterPageFile="~/Views/Shared/Site.Master" 
    AutoEventWireup="true" CodeBehind="Index.aspx.cs" 
    Inherits="Pim.Web.Views.Contacts.Index" %>
<%@ Import Namespace="Pim.Web" %>
<%@ Import Namespace="Pim.Web.Controllers" %>
<%@ Import Namespace="Pim.BusinessLayer" %>

<asp:Content ID="Content2" 
    ContentPlaceHolderID="mainContent" runat="server">
    <%=Html.ActionLink<ContactsController>(c 
       => c.Create(null), "Add New Contact") %>    

    <table cellspacing="0" cellpadding="4" border="1">
        <tr>
            <th scope="col">First Name</th>
            <th scope="col">Last Name</th>
            <th scope="col">Email</th>
            <th scope="col"> </th>
        </tr>

        <%foreach(GetContactListResult contact in 
            this.ViewData.Model) { %>
            <tr>
                <td><%=contact.FirstName %></td>
                <td><%=contact.LastName %></td>
                <td><%=contact.Email%> </td>
                <td>
                    <%=Html.ActionLink<ContactsController>(c => 
                        c.Create(contact.ContactID), "Edit")%>
                    <%=Html.ActionLink<ContactsController>(c => 
                        c.Delete(contact.ContactID), "Delete") %>
                </td>
            </tr>
        <% } %>
   </table>
</asp:Content>
comments powered by Disqus
Most   Popular
Upcoming Events

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.