Add MultiSelector value to Model

  1. #1

    Add MultiSelector value to Model

    Hello FabrÃ*cio
    I apologize for the length of the Thread before anything.but it is Last question.
    As usual Mvc Grab the fields in View.for simple components like TextField and combo i used from "Value" atribute or ControlFor like What is mentioned below.
       X.TextField().ID("NumOfStudent").FieldLabel("students").Value(Model.NumOfStudent).Cls("SetFont")
    or
     X.ComboBox().RTL(true)
    
                 .ID("ComboBoxPerson")
                  .TypeAhead(true)
                 .QueryMode(DataLoadMode.Local)
                 .ForceSelection(true)
                 .TriggerAction(TriggerAction.All)
                 .DisplayField("Text")
                 .ValueField("Value")
                 .Cls("combo-rtl")
                 .BaseCls("combo-rtl")
                 .EmptyValue(0)
                 .ControlFor("Title")   
                 .Items((IEnumerable<Ext.Net.ListItem>)ViewBag.Data)
    My last question is that how Can i add multiselector Value to Model
    I examined following codes but the model was not filled
      Html.X().MultiSelector()
                                                  .Width(400)
                                                  .Height(120)
                                                  .FieldName("Title")
                                                  .MultiSelect(true)
                                                  .AutoScroll(true)
                                                  .ControlFor("Units")
                                                  .Scrollable(ScrollableOption.Both)
                                                  .AllowDeselect(true)
                                                  .Selectable(true)
                                                  .Store(
                                                      Html.X().Store().ID("UnitStore")
                                                          .DataSource(Model.PartUnits)
                                                          .Model(
                                                              Html.X().Model()
                                                                  .Fields(
                                                                      new ModelField("Title", ModelFieldType.String),
                                                                      new ModelField("Id", ModelFieldType.Int)
                                                                  )
                                                          )
                                                  )
                                                  .Search((searchcomp) =>
                                                  {
                                                      searchcomp.Add(
                                                          Html.X().MultiSelectorSearch() 
                                                              .SearchGridConfig(Html.X().GridPanel().BufferedRenderer(false))
                                                              .Store((store) =>
                                                              {
                                                                  store.Add(
                                                                      Html.X().Store()
                                                                          .ID("UnitStores")
                                                                          .DataSource(Model.Units)
                                                                          .Model(
                                                                              Html.X().Model()
                                                                                  .Fields(
                                                                                      new ModelField("Title", ModelFieldType.String)
                                                                                  )
                                                                          )
                                                                      );
                                                              })
                                                          );
                                                  })
    and model
     public class EdPersonCreateVm : BaseEntityVm, IHaveCustomMappings
        {
            public IEnumerable<EdUnit> Units { get; set; } = null;
            public IEnumerable<EdUnit> PartUnits { get; set; } = null;
            public List<SelectListItem> roleList { get; set; }
            public ICollection<EdClass> Classes { get; set; }
            public IEnumerable<EdFeedBackBox> FeedBacks { get; set; }
            public ICollection<EdLesson> Lessons { get; set; }
    
            public IEnumerable<object> Unt { get; set; } = null;
    .
    .
    .
    }
    It also did not work
     .ControlFor("Unt")
    i need list of UnitId's that is displayed in the multiselector but this component has not ValueField for Setting" UnitId".I need this for use in controller but viewPage does not Grab Value of Multiselector.
    if i can attach value of Multiselector(array or list of Id's) to Model my problem is Solved.
    Thank you very much for help
    Last edited by orpheus; Jan 19, 2019 at 11:10 AM.
  2. #2
    Does anyone have an idea?if i cant collect itemsId in multiSelector in the model this will not usable for me.
    thanks
    Last edited by orpheus; Jan 23, 2019 at 5:36 AM.
  3. #3
    Hello,

    I've moved your question to a new thread. As the other had already been defined and your question (although about the same component and model binding) goes beyond what's being dealt there, it would be better for people to find your post in a new thread.

    Hope you understand.

    Unfortunately I don't have an answer for you at this moment, I will post back here if I can understand your question and know the answer for it.
    Fabrício Murta
    Developer & Support Expert
  4. #4
    hello
    I hope you get good results because i fall in deadlock.
    thank you

Similar Threads

  1. Replies: 10
    Last Post: Jan 17, 2019, 3:31 PM
  2. Multiselector Clear and DataBind.
    By oespiao in forum 4.x Help
    Replies: 1
    Last Post: Mar 01, 2017, 12:20 PM
  3. [CLOSED] Set FieldLabel for MultiSelector
    By speedstepmem4 in forum 3.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 18, 2015, 6:56 AM
  4. Replies: 2
    Last Post: Apr 21, 2014, 8:24 AM
  5. Replies: 1
    Last Post: Jul 30, 2013, 3:36 PM

Posting Permissions