I have a multiselect dropdown in a valuetemplate of a querybuilder.When I select a item in the multiselect dropdown it fires the OnValueSelect event which I process by updating the querybuilder's rule model. The my StringListSelect function is called by the event completes Ok with no exception generated but after the function completes the follow exceptions fire:
Exception thrown: 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' in Microsoft.CSharp.dll
Exception thrown: 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' in System.Linq.Expressions.dll
Exception thrown: 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' in System.Private.CoreLib.dll
Exception thrown: 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' in Microsoft.AspNetCore.Components.dll
Exception thrown: 'System.IndexOutOfRangeException' in Microsoft.AspNetCore.Components.dll
I get the following the console of the browser:
blazor.server.js:19 [2020-12-16T11:04:44.917Z] Error: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot implicitly convert type 'string' to 'string[]'
at CallSite.Target(Closure , CallSite , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at Syncfusion.Blazor.QueryBuilder.Internal.QueryBuilderRules`1.SetOperator()
at Syncfusion.Blazor.QueryBuilder.Internal.QueryBuilderRules`1.OnParametersSetAsync()
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
protected void StringListSelect(SelectEventArgs e, RuleModel ruleModel)
{
try
{
string output = JsonConvert.SerializeObject(e.ItemData);
var SelectedValue = JsonConvert.DeserializeObject<DashBoardScopeListValue>(output).Value;
ruleModel.Value = SelectedValue;
}
catch (Exception ex)
{
}
}
<QueryBuilderTemplates>
<ValueTemplate>
@if (context.Operator == "notin" || context.Operator == "in")
{
List<DashBoardScopeListValue> DashBoardScopeListValueObj = this.GetDashBoardScopeListValue(context.Field);
string Placeholder = "BoE";
string FilterBarPlaceholder = "blah";
<SfMultiSelect TValue=@string[] Placeholder=@Placeholder Mode="@VisualMode.CheckBox" ShowSelectAll=@true EnableSelectionOrder=@true ShowDropDownIcon=@true DataSource=@DashBoardScopeListValueObj FilterBarPlaceholder=@FilterBarPlaceholder PopupWidth="Auto">
<MultiSelectFieldSettings Text="Text" Value="Value"></MultiSelectFieldSettings>
<MultiSelectEvents TValue="string[]" OnValueSelect=@(e => StringListSelect(e, context))></MultiSelectEvents>
</SfMultiSelect>
}
else
{
<SfTextBox ValueChange=@(e => StringTextChange(e, context)) Placeholder='Enter custom Value'></SfTextBox>
}
</ValueTemplate>
</QueryBuilderTemplates>
</QueryBuilderColumn>