How to prevent onclick event to be triggered on every row rendering?

The Blazor DataGrid have a column with icon and anchor link; the link uses onclick in it. How to prevent onclick event to be triggered on every row rendering?


1 Reply 1 reply marked as answer

SS Syncfusion Support Syncfusion Team July 14, 2021 11:39 AM UTC

We recommend you to use @onclick event that will not be triggered on row rendering. The @ symbol informs the complier that the event have an executable method. The onclick without `@` is a JavaScript event. Here is the code with @onclick event,


<GridColumn Field=@nameof(Order.OrderID) HeaderText="Action" TextAlign="TextAlign.Center" AutoFit="true">

<Template>

@{

var rule = (context as Order);

<a rel='nofollow' href="#" title="View" @onclick="@(() => OnUserActionClick(rule.RuleId, Common.UserAction.View))">

<span class="custom-icons e-icons e-preview" />

a>

}

Template>

GridColumn>



Marked as answer
Loader.
Up arrow icon