I am using class Meni to define my Panel Menu. It looks like this.
public class Meni
{
public bool New { get; set; }
public bool Updated { get; set; }
public string Name { get; set; }
public string Icon { get; set; }
public string Path { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public bool Expanded { get; set; }
public string onclick { get; set; }
public IEnumerable Children { get; set; }
public IEnumerable Tags { get; set; }
}
It has a new onclick string with my struggle to make some changes whenever the user returns to the root page. Probably this is not the best way but I learned that there is an onclick handle (only in hand coding radzenmenu) and I would like just to add a string with code that will do the job for me. If there is some easier or only doable way feel free to suggest to me.
Thanks.
Hi @Djordje,
I don't think a string property could be executable C# code (unless I am mistaken for the purpose of onclick
). You can try with Action
.
I found your response to question from year or so ago and it looks like this:
<RadzenMenuItem Text="Text" @onclick="@(args => Console.WriteLine(args))">
</RadzenMenuItem>
So I naively thought that it was possible. But if I make a menu from static declaration I suppose that this onclick thing will work.
Regards.
It isn't possible - you will get a compilation error if you try that. What you have pasted is the normal way of handling a Blazor event. The parser converts that to a delegate.
In your case I would recommend setting the Click handler of RadzenMenu instead and using the event argument to determine which item was clicked.