Support forum for ASP.NET Zero (https://aspnetzero.com/).
By Mitch
#30684 I'm using the Core MVC and jQuery with Telerik Controls.

All controls are working well except for the MultiSelect. It must be bound to a String array to pass the selected values to the control.

Code: Select allpublic string[] CaseConditionsArray { get; set; }


I can successfully pass the previously selected values to the control and they display correctly. I can also add or remove additional items from the selected list.

My problem occurs when I need to save the data. I get a validation popup message "Your request is not valid!" "The following errors were detected during validation - ". However, nothing is listed.

In the Logs.txt the following errors are logged

Code: Select allWARN  2018-07-12 00:38:58,739 [39   ] Mvc.ExceptionHandling.AbpExceptionFilter - Method arguments are not valid! See ValidationErrors for details.
Abp.Runtime.Validation.AbpValidationException: Method arguments are not valid! See ValidationErrors for details.
   at Abp.Runtime.Validation.Interception.MethodInvocationValidator.ThrowValidationError()
   at Abp.Runtime.Validation.Interception.MethodInvocationValidator.Validate()
   at Abp.AspNetCore.Mvc.Validation.AbpValidationActionFilter.<OnActionExecutionAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextExceptionFilterAsync>d__23.MoveNext()
WARN  2018-07-12 00:38:58,740 [39   ] Mvc.ExceptionHandling.AbpExceptionFilter - There are 1 validation errors:
WARN  2018-07-12 00:38:58,740 [39   ] Mvc.ExceptionHandling.AbpExceptionFilter -  (caseConditionsArray)
INFO  2018-07-12 00:38:58,748 [39   ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext.
INFO  2018-07-12 00:38:58,750 [39   ] ore.Mvc.Internal.ControllerActionInvoker - Executed action DpmsCloud.DpmsClientCases.DpmsClientCasesAppService.CreateOrEdit (DpmsCloud.Application) in 321.2847ms
INFO  2018-07-12 00:38:58,754 [39   ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 334.6294ms 400 application/json; charset=utf-8


I don't have any issues with any other controls. I'm wondering if the problem is caused by the Multiselect requiring a string array rather than a simple string, int or datetime like the other controls.

Do you have any suggestions how to fix this issue?
By Mitch
#30693 Thanks for responding.

Since my initial email I've tried to use the standard MVC DropDownList (Multiple) and I'm getting similar problems so the issue isn't Telerik specific.

Here's the code for the standard MVC dropdown I'm using

Code: Select all@Html.DropDownList("caseConditions", (MultiSelectList)ViewBag.Categories, new { multiple = "multiple" })


If CaseConditions is a String it just saves only 1 item.

If CaseConditions is a String[] I get an error. The same shown as before.

Before sending more code, has anybody had any success using any standard MVC Multi select with ASP Net Zero?

If so, how did you manage to Post the selected items without errors or only having 1 item saved?
By Mitch
#30697 As requested, the following was what I was getting for the Telerik control when bound to a String[].

Response
{"result":null,"targetUrl":null,"success":false,"error":{"code":0,"message":"Your request is not valid!","details":"The following errors were detected during validation.\r\n - \r\n","validationErrors":[{"message":"","members":["caseConditionsArray"]}]},"unAuthorizedRequest":false,"__abp":true}

Request Payload
{"id":"6effe3ec-5e0d-4dee-a4ba-a7e187f15cec","dpmsClientId":"0a3c603f-4e0b-43d5-05ae-08d5e0c249cb","caseStartDate":"03/07/2018","caseEndDate":"","caseFlag":"","caseConditionsArray":"Do not visit home","casePriorityMessage":"","ageAtReferral":"","caseNewReturner":"New","caseRole":"Survivor","timeElapsedBeforeSupport":"","caseLocation":"","currentSituation":"","currentStatus":"","statusFrequency":"","initialSituation":"","initialStatus":"","initialFrequency":""}

Code: Select all[AbpMvcAuthorize(AppPermissions.Pages_DpmsClientCases_Create, AppPermissions.Pages_DpmsClientCases_Edit)]
        public async Task<PartialViewResult> CreateOrEditModal(Guid? id)
        {
         GetDpmsClientCaseForEditOutput getDpmsClientCaseForEditOutput;

         if (id.HasValue){
            getDpmsClientCaseForEditOutput = await _dpmsClientCasesAppService.GetDpmsClientCaseForEdit(new EntityDto<Guid> { Id = (Guid) id });
         }
         else{
            getDpmsClientCaseForEditOutput = new GetDpmsClientCaseForEditOutput{
               DpmsClientCase = new CreateOrEditDpmsClientCaseDto()
            };
         }

            var viewModel = new CreateOrEditDpmsClientCaseModalViewModel()
            {
            DpmsClientCase = getDpmsClientCaseForEditOutput.DpmsClientCase,
               DpmsClientName = getDpmsClientCaseForEditOutput.DpmsClientName
            };

            viewModel.DpmsClientCase.CaseConditionsArray = viewModel.DpmsClientCase.CaseConditions.Split(',');

            return PartialView("_CreateOrEditModal", viewModel);
        }
By Mitch
#30709 Many thanks for your offer of help. I've spent about 4 hours stripping my app down to the bare bones so that I can send you a representative example of the problem.

The email has just been sent to you along with a WeTransfer file as the app is too big to attach to an email.