We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

State issues with dropdown list

Hello,
I have tried to add a cascading dropdown list to the start blazor project (server side) and I am running into issues. 
The first issue is that the rel attritbute is not being accepted as valid on the component. I already posted about this in a different thread. However, there is an addtional issue that I am trying to work through. When I add the component it shows and seems to work well but if I switch to a different page it is showing partially there and I get these errors in the console log. 

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: accessor
   at Microsoft.AspNetCore.Components.Forms.FieldIdentifier.Create[T](Expression`1 accessor)
   at Syncfusion.EJ2.RazorComponents.DropDowns.EjsDropDownList.set_Value(Object value)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
   at Syncfusion.EJ2.RazorComponents.BaseComponent.UpdateModel(String value)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.JSInterop.DotNetDispatcher.InvokeSynchronously(String assemblyName, String methodIdentifier, Object targetInstance, String argsJson)
   at Microsoft.JSInterop.DotNetDispatcher.BeginInvoke(String callId, String assemblyName, String methodIdentifier, Int64 dotNetObjectId, String argsJson)
Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: accessor
   at Microsoft.AspNetCore.Components.Forms.FieldIdentifier.Create[T](Expression`1 accessor)
   at Syncfusion.EJ2.RazorComponents.DropDowns.EjsDropDownList.set_Value(Object value)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
   at Syncfusion.EJ2.RazorComponents.BaseComponent.UpdateModel(String value)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.JSInterop.DotNetDispatcher.InvokeSynchronously(String assemblyName, String methodIdentifier, Object targetInstance, String argsJson)
   at Microsoft.JSInterop.DotNetDispatcher.BeginInvoke(String callId, String assemblyName, String methodIdentifier, Int64 dotNetObjectId, String argsJson)
    at endInvokeDotNetFromJS (https://localhost:44306/_framework/blazor.server.js:8:21783)
    at https://localhost:44306/_framework/blazor.server.js:8:21434
    at new Promise (<anonymous>)
    at e.beginInvokeJSFromDotNet (https://localhost:44306/_framework/blazor.server.js:8:21403)
    at https://localhost:44306/_framework/blazor.server.js:1:16653
    at Array.forEach (<anonymous>)
    at e.invokeClientMethod (https://localhost:44306/_framework/blazor.server.js:1:16624)
    at e.processIncomingData (https://localhost:44306/_framework/blazor.server.js:1:14624)
    at e.connection.onreceive (https://localhost:44306/_framework/blazor.server.js:1:11165)
    at WebSocket.i.onmessage (https://localhost:44306/_framework/blazor.server.js:1:30454)
throwError @ ejs.interop.min.js:1
blazor.server.js:15 [2019-06-27T03:07:43.911Z] Error: System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.AspNetCore.Components.CascadingValue`1.Microsoft.AspNetCore.Components.ICascadingValueComponent.Unsubscribe(ComponentState subscriber)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.RemoveCascadingParameterSubscriptions()
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.DisposeInBatch(RenderBatchBuilder batchBuilder)
   at Microsoft.AspNetCore.Components.Rendering.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
   at Microsoft.AspNetCore.Components.Rendering.Renderer.ProcessRenderQueue()

I have attached the project so it can be easily reproduced. I am using the latest versions of VS Preview, blazor and SF. 

Thanks in advance for the help. 

Ryan 

Attachment: AgencyPortalBlazor_b2650ca9.rar

3 Replies

BC Berly Christopher Syncfusion Team June 27, 2019 10:29 AM UTC

Hi Ryan, 
  
  
Greetings from Syncfusion. 
  
  
Query 1: I have tried to add a cascading dropdown list to the start blazor project (server side) and I am running into issues.  
  
 
Response:  We have checked your reported issue (“I get these errors in the console log”). Based on our validation, this issue is caused due to rendering the component inside the EditForm. We need to bind the value to component(@bind-value) from the model class. We have modified the code in the provided sample. 
  
[Counter.razor
  
<EditForm Model="@booking" OnValidSubmit="@HandleValidSubmit"> 
    <DataAnnotationsValidator /> 
    <ValidationSummary /> 
 
    <InputText id="name" @bind -Value="@booking.CustomerFirstName" /> 
    <EjsDropDownList ID="gamesDropDown" PlaceHolder="Select a game" @bind -Value="@booking.ProductName" DataSource="@localdata" Change="@onSupplierChange"> 
        <DropDownListFieldSettings Text="text" value="id"></DropDownListFieldSettings> 
    </EjsDropDownList> 
    <EjsDropDownList PlaceHolder="Select a player" ID="playersDropDown" @bind -Value="@booking.SupplierName" DataSource="@localdata2" Enabled="@playersDropDownEnabled"> 
        <DropDownListFieldSettings Text="text" Value="id"></DropDownListFieldSettings> 
    </EjsDropDownList> 
 
    <button type="submit">Submit</button> 
</EditForm> 
@code { 
    public bool playersDropDownEnabled = true; 
 
    private BookingViewModel booking = new BookingViewModel(); 
   
  
Please find the modified sample from below link 

Query2: When navigating other pages console error throws. 

Response: We can able to reproduce the navigation issue. We are checking the issue in blazor routing and we will update further details on 28th June 2019. We appreciate your patience until then. 
  
Regards, 
Berly B.C 



GG Gopi Govindasamy Syncfusion Team June 28, 2019 02:52 PM UTC

Hi Ryan,   

Thank you for the patience. 

The reported issue was validated, it occurred in preview 6 Blazor source. The problem occurred while using the cascading object value in the child component. At our end, we verified this as a bug and this fix will be available at the end of July 2019. Until then, we appreciate your patience. From the feedback link below you can track the status of the reported issue. 


Regards, 
Gopi G. 



RR Ryan Richards June 29, 2019 04:11 AM UTC

Thank you for the update and timeframe. 

Loader.
Live Chat Icon For mobile
Up arrow icon