Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to stop event propagation in Blazor Server app

$
0
0

I'm using Grid.Blazor library to render server side grid on Blazor app. One of the column has a button with click event. So when button is clicked then grid row event is also fired along with button click event. I want to stop event propagation and only let button click event fired.

Grid:

<GridComponent    @ref="_gridComponent"    T="QuickLists"    Grid="@_grid"    OnRowClicked="@(async (item) => await ExerciseDetails(item))" />
Action<IGridColumnCollection<QuickExcerciseLists>> columns = c =>{    c.Add().Titled("Actions").RenderComponentAs(typeof(ChildComponent)).SetWidth("5%");    c.Add(o => o.Name, comparer).Titled("Name").SetWidth("10%");    c.Add(o => o.Age, comparer).Titled("Age").SetWidth("15%");    c.Add(o => o.Address, comparer).Titled("Address").RenderComponentAs<MatTooltip>().SetWidth("15%");};

Custom Column Component :

<MatBlazor.MatButton    Icon="@MatIconNames.Remove_red_eye"    @onclick="@ShowData"    @onclick:stopPropagation="true" />

I tried passing @onclick:stopPropagation in the child button component. But it's given below compile error.

The component parameter 'onclick' is used two or more times for thiscomponent. Parameters must be unique (case-insensitive). The componentparameter 'onclick' is generated by the '@onclick:stopPropagation'directive attribute.

I'm running .NET Core 3.1.201. Any help is highly appreciated.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>