How do I get Asp.net MVC BeginForm to add closing tag correctly?
Posted
by Matt
on Stack Overflow
See other posts from Stack Overflow
or by Matt
Published on 2010-06-15T09:55:22Z
Indexed on
2010/06/15
10:12 UTC
Read the original article
Hit count: 275
I seem to be missing something obvious here, but cannot see what it is.
My problem is that the closing form tag for BeginForm is not being added to my markup. I am looping through a collection and creating a form for each item, but the forms arent closing properly. Any suggestions please?
Thanks
<% foreach (var item in Model) { %>
<% using (Html.BeginForm("EditUser","Users"))
{ %>
<tr>
<td>
<input id="contactID" type="hidden" value="<%= item.ContactID %>" />
<%=item.Email %>
</td>
<td>
<%=item.Market.MarketName%>
</td>
<td>
<%=item.ContactType.ContactTypeName%>
</td>
<td>
<input type="submit" value="Edit" />
</td>
</tr>
<%} %>
<% } %>
© Stack Overflow or respective owner