Mar 25, 2013, 8:16 AM
-
-
Mar 26, 2013, 1:45 AMHello!
Thank you for your report. Can you provide example to reproduce?
http://forums.ext.net/showthread.php?10205 -
Mar 26, 2013, 6:34 AMI just add a submit button to your demo code ( http://mvc.ext.net/#/Models/Model_Bind/ ) to see post result.
..................................Controller...... .....................................
............................ View.......................................using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace Ext.Net.MVC.Examples.Areas.Models.Controllers { public class Model_BindController : Controller { public ActionResult Index() { return View(new Model_BindModel { TextValue = "TextValue", DateTimeValue = DateTime.Now, ComboValue1 = new ListItem("Item 3", "3"), ComboValue2 = new ListItem[] { new ListItem("Item 1", "1"), new ListItem("Item 5", "5") }, ComboValue3 = "2", CheckboxValue = true, NumberValue = 1, MultiSliderValue = new int[] { 10, 40, 70 }, Data = new ListItem[] { new ListItem("Item 1", "1"), new ListItem("Item 2", "2"), new ListItem("Item 3", "3"), new ListItem("Item 4", "4"), new ListItem("Item 5", "5") } }); } public ActionResult DirectEventSubmit(Model_BindModel ModelBind) { X.Msg.Alert("Submit", JSON.Serialize(ModelBind)).Show(); return this.Direct(); } } }
.................................................. ............Model................................. .............@model Ext.Net.MVC.Examples.Areas.Models.Model_BindModel @{ ViewBag.Title = "Model Bind"; Layout = "~/Views/Shared/_BaseLayout.cshtml"; } @section example { <h1>Model Bind</h1> @( Html.X().FormPanel() .Layout(LayoutType.Form) .Width(350) .FieldDefaults(d => { d.LabelWidth = 150; }) .ID("FormPanel1") .BodyPadding(10) .Frame(true) .Items( Html.X().TextFieldFor(m => m.TextValue), Html.X().DateFieldFor(m => m.DateTimeValue), Html.X().ComboBoxFor(m => m.ComboValue1).Items(Model.Data), Html.X().ComboBoxFor(m => m.ComboValue2).Items(Model.Data), Html.X().ComboBoxFor(m => m.ComboValue3).Items(Model.Data), Html.X().CheckboxFor(m => m.CheckboxValue), Html.X().NumberFieldFor(m => m.NumberValue), Html.X().SliderFor(m => m.MultiSliderValue) ) .Buttons( Html.X().Button() .Text("Submit variations") .MenuItem( Html.X().MenuItem() .Text("DirectEvent submit") .DirectEvents(de => { de.Click.Url = Url.Action("DirectEventSubmit"); de.Click.EventMask.ShowMask = true; de.Click.FormID = "FormPanel1"; }) ) ) ) }
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Web.Mvc; using Ext.Net; namespace Ext.Net.MVC.Examples.Areas.Models { public class Model_BindModel { [Field(FieldLabel="TextField")] public string TextValue { get; set; } [Field(FieldLabel = "DateField")] public DateTime DateTimeValue { get; set; } [Field(FieldLabel = "ComboBox 1")] public ListItem ComboValue1 { get; set; } [Field(FieldLabel = "ComboBox 2")] public IEnumerable<ListItem> ComboValue2 { get; set; } [Field(FieldLabel = "ComboBox 3")] public string ComboValue3 { get; set; } [Field(FieldLabel = "CheckBox")] public bool CheckboxValue { get; set; } [Field(FieldLabel = "NumberField")] public int NumberValue { get; set; } [Field(FieldLabel = "MultiSlider")] public int[] MultiSliderValue { get; set; } public IEnumerable<ListItem> Data { get; set; } } }
Last edited by Baidaly; Mar 26, 2013 at 9:22 PM. Reason: Please, use the [CODE] tag -
Mar 26, 2013, 9:35 PMThis is default behavior of ASP.NET MVC ModelBinder with Complex type and Enumerable. To access ComboBox values you should use the following approach:
Thread was moved to 2.x Help forum.public ActionResult DirectEventSubmit(string ComboValue1, string ComboValue2, string ComboValue3) { return this.Direct(); }
Last edited by Baidaly; Mar 26, 2013 at 11:34 PM.
Similar Threads
-
ComboBoxFor and empty value after load
By zwf in forum 2.x HelpReplies: 1Last Post: Nov 12, 2012, 1:46 PM -
[CLOSED] ComboBoxFor doesn't show description after page loads ...
By zwf in forum 2.x Legacy Premium HelpReplies: 3Last Post: Nov 05, 2012, 11:51 AM -
How to get only text from html editor with out html tags?
By i3class in forum 1.x HelpReplies: 9Last Post: Oct 08, 2012, 7:49 AM -
[CLOSED] Label's "HTML" property drops certain HTML Formatting When Set
By dmoore in forum 1.x Legacy Premium HelpReplies: 2Last Post: Nov 03, 2011, 5:24 PM -
How to show html content in a textfield as text value no html rendering
By lordofthexings in forum 1.x HelpReplies: 1Last Post: May 28, 2010, 1:13 PM