I have some text fields binding inside a for loop.
<Input type="text" @onchange='(ChangeEventArgs e)=>DataChange(e,item)' value="@item.value" />
here if user type anything to the input fields I have a custom validation inside DataChange
function.
private void DataChange(ChangeEventArgs e, PnL pnl)
{
if(e.Value.ToString().Contains(10))
{
pnl.value = e.Value.ToString();
}
}
if change is valid then only Iam assigning value to the item in the list. But if its invalid i need to reset the value to original.
I have tried calling StateHasChange()
but that didn't helps.
Can anybody helps?