Note that there are some explanatory texts on larger screens.

plurals
  1. POForeach MVC3 MembershipUser
    primarykey
    data
    text
    <p>i have implemented a class inherits TableServiceEntity that adds a few propertys called UserEntity.</p> <p>In a view, i want to do a foreach loop to show all the entries like this:</p> <pre><code>@model MembershipUserCollection </code></pre> <p>If i do </p> <pre><code> @foreach (UserEntity user in Model) { &lt;td&gt; @Html.DisplayFor(modelItem =&gt; user.ID_client) &lt;/td&gt; &lt;td&gt; @Html.DisplayFor(modelItem =&gt; user.Username) &lt;/td&gt; .... .... } </code></pre> <p>VS2010 tells me that cant convert an object type from 'System.Web.Security.MembershipUser' to 'AzureTableStorage.UserEntity'.</p> <p>And if i change the model</p> <pre><code>@model UserEntity </code></pre> <p>The shows me another error..</p> <p>foreach statement cannot operate on variables of type 'UserEntity' because 'UserEntity' does not contain a public definition for 'GetEnumerator' </p> <p>And the UserEntity class have the properties declared like this..</p> <pre><code> public class UserEntity : TableServiceEntity { public UserEntity(string partitionKey, string rowKey) : base(partitionKey, rowKey) { } public UserEntity() : this(Guid.NewGuid().ToString(), String.Empty) { } public int ID_client { get; set; } public String Username { get; set; } public String Password { get; set; } public String Email { get; set; } </code></pre> <p>.......... ....... ......</p> <p>(Where Username and some more properties are the same from MembershipUser.. but not alls, i have added 3 or 4 extra).</p> <p>Can someone helps me?</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload