I want to have a datagrid and a card with label under it with binded date like this https://blazor.radzen.com/master-detail
But then i try to put it in radzen, like this video - https://www.youtube.com/watch?v=C_nEw-BAzvY&t, there is no data binding to text area, and when i bind it with code as ${order.OrderID) i get cannot perform runtime binding on a null reference. I get it, that its because when i load the page, no row is selected in the datagrid. How can i get i to work, or to select the firs row of datagrid on default?
Hi @Stefan_Stefanov1,
You can set the Visible property of the Label to ${order != null}
. The other thing you can try is the elvis operator ${order?.OrderID}
.
No, i still have the same problem. Is there another way?
That should have worked. Can you post some screenshots that show your configuration?
Does it work at runtime though?
nope, it compiles but it leaves blank page.
this is the massege in the console:
warn: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100]
Unhandled exception rendering component: Cannot perform runtime binding on a null reference
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference
at CallSite.Target(Closure , CallSite , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at CoBg.Pages.?????.b__0_0(RenderTreeBuilder __builder2)
at Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.AddContent(Int32 sequence, RenderFragment fragment)
at Radzen.Blazor.RadzenContent.BuildRenderTree(RenderTreeBuilder __builder)
at Microsoft.AspNetCore.Components.ComponentBase.<.ctor>b__6_0(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()
dotnet: fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
Unhandled exception in circuit 'A5rQlVtQhLbba6PIUtqY_LHV-AsenIhD7sSyRsSMRsA'.
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference
at CallSite.Target(Closure , CallSite , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at CoBg.Pages.?????.b__0_0(RenderTreeBuilder __builder2)
at Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.AddContent(Int32 sequence, RenderFragment fragment)
at Radzen.Blazor.RadzenContent.BuildRenderTree(RenderTreeBuilder __builder)
at Microsoft.AspNetCore.Components.ComponentBase.<.ctor>b__6_0(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()
I received an update to the program, but the problem persists. Is it possible to select the first line from the grid when loading the view? I tried this Datagrid programly select a line, but i doesnt work no more. Maybe FirstorDefault method? Or when generating datagrid to have it on default whit this function?
Our DataGrid with Form page template supports this out of the box. I suggest you try it.
Thenks for that. By looking at the code i figured it out. So the the name of the set property should be defied two times - on the page it self, and on the grid on select row. For example "Click". On the page value should be result.FirstOrDefault(), and most important - property type should load automaticaly - for me is Appname.Models.DatabaseofApp.TableFromDataBase. Then on the grid itself the set property on rowselect - property type should be changed from dynamic to the same as the one on the page. And now it works. For some reason dynamic is not working properly.