This is a migrated thread and some comments may be shown as answers.

Selected data not being sent back to controller

3 Answers 107 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
DominionZA
Top achievements
Rank 1
DominionZA asked on 05 Aug 2013, 02:16 PM
My previous post went unanswered and had to figure it out myself (so much for premium support), but eventually got it figured out. Now I am stuck again - with the same stupid widget.
$999 for half working widgets, basic documentation and no support is starting to seriously get to me.

Anyway, I am populating my Multiselect widget with a list of Weighbridges. This part works fine. I can also select weighbridges with no problem.
When I post back to the controller, the model reflects the number of items I selected in the Multiselect, but the data is either null (for strings) or 0 (for ints).

Controller populating the ViewBag
ViewBag.Weighbridges = dbDataService.ToLookUp<Weighbridge>();
My Lookup class
public class LookupEntity : ILookupEntity
{
    public int Id { get; set; }
    public string Description { get; set; }
}
Widget implementation
@(Html.Kendo().MultiSelectFor(model => model.Weighbridges)
                      .Name("Weighbridges")
                      .DataTextField("Description")
                      .DataValueField("Id")
                      .Value(Model.Weighbridges)
                      .Placeholder("Select weighbridges...")                
                      .HtmlAttributes(new {style= "width:310px"})                     
                      .AutoBind(true)
                      .BindTo((IEnumerable<LookupEntity>)ViewBag.Weighbridges)
                )
My UserModel class with the portion of interest.
[DisplayName("Assigned Weighbridges")]
public IEnumerable<LookupEntity> Weighbridges { get; set; }


Upon posting back to the controller, the rest of the model details are 100%. My Weighbridges property shows the number of items that were selected in the Multiselect, but none of the values are set.

I am using the Multiselect in a popup editor for grid editing.

Can someone help? And today please. I have wasted 2 full working days trying to get the Multiselect to work. KendoUI is supposed to boost productivity surely?









3 Answers, 1 is accepted

Sort by
0
DominionZA
Top achievements
Rank 1
answered on 06 Aug 2013, 07:26 AM
I need to figure out how support works with Kendo. Is it quicker to get a response via email? Are the support forums checked once a week or something?

I have yet to get a quick response via the forums. Going to try direct email now.
0
Accepted
Daniel
Telerik team
answered on 06 Aug 2013, 02:33 PM
Hello,

The quickest way to get a response is to submit a support ticket from your account. We guarantee a 24 hours response time for tickets. 
Regarding the issue - you should use the request Data function to serialize the collection in a way that can be processed by the ModelBinder. Please check this code-library project for a sample.

Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
DominionZA
Top achievements
Rank 1
answered on 08 Aug 2013, 10:28 AM
Thanks. It is working now - and nicely too.

Appreciate the feedback.
Tags
MultiSelect
Asked by
DominionZA
Top achievements
Rank 1
Answers by
DominionZA
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or