This is a migrated thread and some comments may be shown as answers.

menuitem text variable error

1 Answer 32 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Alberto
Top achievements
Rank 1
Alberto asked on 10 Oct 2019, 12:59 PM

When setting menu items text with a variable the application fails with error.

var x = "XXX";

MenuItems.Add(new MenuItem()
            {
                Text = x,
                Path = "/test"
            });

 

 

error:

blazor.server.js:15 [2019-10-10T12:54:11.068Z] Error: System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Blazor.Components.TelerikMenu`1.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()

1 Answer, 1 is accepted

Sort by
0
Alberto
Top achievements
Rank 1
answered on 10 Oct 2019, 02:56 PM
You can ignore this. the problem was other thing and already fixed and everything work.
Tags
Menu
Asked by
Alberto
Top achievements
Rank 1
Answers by
Alberto
Top achievements
Rank 1
Share this question
or