ui-helper

ASP.NET MVC UI Template: How to mix an IList Model property with EditorFor( m => m.subModel)?

心已入冬 提交于 2019-12-13 17:23:39
问题 Say you have this: public class ShoppingCart { public IList<CartItem> cartItems {get; set; } } And you do this to render the class: <%= EditorFor( m => m.ShoppingCart, "ShoppingCart") %> How would you do the EditorFor( ??, "CartItem") in the ShoppingCart.ascx? I would think it would look something like this: <% foreach( CartItem myCartItem in m.cartItems) { %><%= EditorFor( ??, "CartItem") %><% } %> The idea here of course is to use a UI template for an entire class, not just a property. 回答1:

asp.net mvc radio button state

吃可爱长大的小学妹 提交于 2019-12-09 05:16:34
问题 I'm trying out asp.net mvc for a new project, and I ran across something odd. When I use the MVC UI helpers for textboxes, the values get persisted between calls. But, when I use a series of radio buttons, the checked state doesn't get persisted. Here's an example from my view. <li> <%=Html.RadioButton("providerType","1")%><label>Hospital</label> <%=Html.RadioButton("providerType","2")%><label>Facility</label> <%=Html.RadioButton("providerType","3")%><label>Physician</label> </li> When the

asp.net mvc radio button state

淺唱寂寞╮ 提交于 2019-12-03 05:56:21
I'm trying out asp.net mvc for a new project, and I ran across something odd. When I use the MVC UI helpers for textboxes, the values get persisted between calls. But, when I use a series of radio buttons, the checked state doesn't get persisted. Here's an example from my view. <li> <%=Html.RadioButton("providerType","1")%><label>Hospital</label> <%=Html.RadioButton("providerType","2")%><label>Facility</label> <%=Html.RadioButton("providerType","3")%><label>Physician</label> </li> When the form gets posted back, I build up an object with "ProviderType" as one of it's properties. The value on