I am using Microsoft MVC and C#. I have a usercontrol (example.ascx) created and at the top I'm inheriting System.Web.MVC.ViewUserControl<PostTransferViewModel>
Now, while my model name is appended to ViewUserControl, I get "The name 'Model' does not exist in the current context" and "The name 'Html' does not exist in the current context. If I removed the <PostTransferViewModel>
from the end of ViewUserControl then everything works fine, but I need <PostTransferViewModel>
.
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<PostTransferViewModel>" %>
<div class="postTransferTank">
<h2>
Approved Post Transfers</h2>
<% if (Model.ApprovedPostTransfers.Count() == 0)
{ %>
<span class="emptyList">There are currently no approved Post Transfers for this tank.</span><br />
<% } %>
<% else
{ %>
<%=Html.DisplayFor(x => x.ApprovedPostTransfers,"PostTransferList") %>
<% } %>
<br />
<%=Html.ActionLink<PostTransferController>(x => x.NewPostTransfer(), "Enter Post Transfer", new { @class = "create-link" })%>
<br />
<% if (Model.DraftPostTransfers.Count() != 0)
{ %>
<h2>
Draft Post Transfers</h2>
<%=Html.DisplayFor(x => x.DraftPostTransfers, "PostTransferList") %>
<% } %>
</div>