tags:

views:

14

answers:

1

Can I have an example of how to use a template view to display an interface have properties ID and Name

A: 

SomeView.ascx:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IMyInterface>" %>

ID: <%= Html.Encode(Model.Id) %>
Name <%= Html.Encode(Model.Name) %>

IMyInterface:

public interface IMyInterface
{
    int Id { get; set; }
    string Name { get; set; }
}

There you go. Hope that helps!

Yngve B. Nilsen