I have a master datagrid which i use to populate the child dtagrids on tabs in my page.
I also populate grandchild datagrids from each child
When i click a new row in the master, the children all reset but not the grandchildren.
How can i empty/hide the grandchild datagrid? I have tried setting the datasource of the grandchild=null when the rowselect event is called by the master but this throws an error.
When the code first runs and the grandhild datagrid has no elements it works fine
when i select the first child the grandchild populates correctly
But when i change row in the parent and 'set property.....Enumerable.Empty' is called i get this error:
I'ved tried wrapping this in a try catch clause but its not catching it in the C#
Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer: Warning: Unhandled exception rendering component: Sequence contains no elements
System.InvalidOperationException: Sequence contains no elements
at System.Linq.ThrowHelper.ThrowNoElementsException()
at System.Linq.Enumerable.First[TSource](IEnumerable1 source) at EsWlite.Pages.AOpportunitiesMain.<BuildRenderTree>b__0_107(RenderTreeBuilder __builder8) at Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.AddContent(Int32 sequence, RenderFragment fragment) at Radzen.Blazor.RadzenGrid1.BuildRenderTree(RenderTreeBuilder __builder)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit 'x0Us35NtaeAAKW68KKWY6zVSYPZuEYgTJg94tktaspk'.
System.InvalidOperationException: Sequence contains no elements
at System.Linq.ThrowHelper.ThrowNoElementsException()
at System.Linq.Enumerable.First[TSource](IEnumerable1 source) at EsWlite.Pages.AOpportunitiesMain.<BuildRenderTree>b__0_107(RenderTreeBuilder __builder8) at Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.AddContent(Int32 sequence, RenderFragment fragment) at Radzen.Blazor.RadzenGrid1.BuildRenderTree(RenderTreeBuilder __builder)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
Microsoft.AspNetCore.Routing.EndpointMiddleware: Information: Executed endpoint '/_blazor'
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 25147.6865ms 101
You can try setting it to null instead. But make sure the Property type remains the same - IEnumerable. Alternatively use a bool property and set the Visible property of the data grid to ${grandChildVisible}. Then set that property to true or false as needed. This will completely hide the datagrid instead of displaying it empty.