If the markup for the checkboxes appears in the source after rendering the page I would suspect some CSS or JavaScript is applying styling or attributes to hide the other checkboxes.
ASP.net MVC2 PartialView displays checkbox for only first item in the model list
-
09-10-2022 - |
Question
I am working on ASP.net MVC 2 web application, I am using a partial view to generate a list. The partial view code looks like following...
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.Collections.Generic.List<DataAccessLayer.Entities.Recipient>>" %>
<%
foreach (DataAccessLayer.Entities.Recipient oRecipient in Model)
{
%>
<tr>
<td width="10%" align="center">
<input type="checkbox" name="recipientCheck" />
</td>
<td width="50%" align="left">
<%: oRecipient.LastName%> <%: oRecipient.FirstName%>
</td>
<td width="40%">
<%: oRecipient.RecipientEmail%>
<%: oRecipient.RecipientPhone%>
</td>
</tr>
<% } %>
This partial view is integrated in a main view like...
<table id="recipientsTable">
<% Html.RenderPartial("RecipientPartialView", Model.StaticClientContacts); %>
</table>
The PROBLEM is it is showing the checkbox only for the first item in the list, if I do firebug or view source it shows that the checkboxes are getting generated. Am I doing anything completely wrong here, anybody has any suggestions?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow