<InputNumber readonly
id="ProductShares"
class="form-control"
placeholder="Product Shares"
oninput="@Calculation"
@bind-Value="product.ProductShares" />
I want to update InputNumber to readonly in code. That is on event oninput I am calling Calculation method and I want to programmatically update readonly property.
public async void Calculation(ChangeEventArgs e)
{
// Something like
if(condition)
{
ProductShares.readonly = true; // ProductShares is the id of the InputNumber
}
else
{
ProductShares.readonly = false;
}
}
You can set bool value to readonly attribute like this
This is your html
This is your code behind