Set checkbox true via Change/onchange

Hi, Ive got a RadzenNumeric and a checkbox in a datagrid. I want the checkbox on the same row to automatcally be set to true when the user changes the value in the numeric textbox. How do I achieve this?

<RadzenDataGridColumn TItem="BusinessCentral.Models.TBC_DEV.DwReportProdcode" Property="forecast_cost" Filterable="false" Title="@L["LabelScost.Text"]">

<RadzenNumeric style="display: block; width: 100%" @bind-Value="@dwReportProdcode.forecast_cost" Name="forecast_cost" Format="#,##0.00" />


image

You can do it from the setter of your property or you can handle Change event of the Numeric and set desired object property.

... and how do I do that? :slight_smile:

dwReportProdcode.forecast_cost populates the radzenNumeric, and when the user changes its value...

dwReportProdcode.forecast_cost

... I want dwReportProdcode.forcChanged which populates the checkbox to become true

dwReportProdcode.forcChanged

<RadzenNumeric @bind-Value="@dwReportProdcode.forecast_cost" Change=@(args => dwReportProdcode.forcChanged = true)  />

Thx, that works if I change from radzenNumeric to RadzenTextbox - but when using radzenNumeric it wont work, I get these errors:

cannot convert from 'Microsoft.AspNetCore.Components.EventCallback' to 'Microsoft.AspNetCore.Components.EventCallback'|

Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type

You can specify the type of the Change event argument to your property type. For example:

Change=@((decimal args) => dwReportProdcode.forcChanged = true)  

Awesome, that did the trick. Many thanks :slight_smile: