I am trying to get a MultiSelect to submit but it just refuse.
I am trying to debug the incoming request from the page and it contains no selectlist value in any way, shape or form.
<div class="demo-section k-content">
@(Html.Kendo().MultiSelectFor(x => x.CMC)
.ValuePrimitive(true)
.BindTo(ViewBag.CMC)
.DataTextField("Name")
.DataValueField("UnitId")
.Filter(FilterType.Contains)
.Placeholder("Välj ett eller flera CMC...")
)
</div>
This is inside a using block that looks like this:
@using (Html.BeginForm("Search", "Search"))
{
}
The model (SearchABR) is fetched from the viewbag as you can see above, and looks like this:
public class SearchABR
{
public string Abonnentnummer { get; set; }
public string Firstname { get; set; }
public string Lastname { get; set; }
public List<CMCEntity> CMC { get; set; }
}
And in this function in the controller:
[Authorize(Roles = "ABR_LOGIN")]
[HttpPost]
public ActionResult Search(SearchABR search)
{
RetreiveInformation ri = new RetreiveInformation();
if (ModelState.IsValid)
{
// Everything is valid. Return the search parameters.
// Fix CMC information.
}
ViewBag.CMC = FetchCMC();
return View(search);
}
And I put a breakpoint at "Fix CMC Information" and cannot find CMC in the Request at all. It's not there. The other fields are there, but not CMC.
Help!