Closed yaju closed 1 year ago
Your attempting to do something that's not supported even with the base InputText. While I could make this work by adding a preventdefault parameter and attribute for each event type. It will get super messy as there are a lot of events. Until they have a better way of passing down the argument predicting all the possible uses that might be needed doesn't seem reasonable. The fact Microsoft hasn't even added a method to support this in their input components. Tells me that they intend you to drop out of the component when trying to use more advanced event binding.
From what you provided as an example, I'm seeing other errors that would prevent that from working anyways. I recommend dropping down to the base HTML input tag and doing.
<input type="text" class="form-control" @onkeydown="KeyDown" @onkeydown:preventDefault="shouldPrevent">
or if you're just intending just to get the value right away, you can do something like
<BSInput InputType="InputType.Text" ValidateOnInput="true" ValueChanged="@((string txt) => OnValueChanged(txt))" value="@Modal.MiddleName" ValueExpression="@(() => Modal.MiddleName)" />
private void OnValueChanged(string e)
{
Modal.MiddleName = e;
Console.WriteLine(e);
}
Thanks. do it another way.
I want to use onkeydown:preventDefault
The following build error. Is there any solution?
RZ10010 The component parameter 'onkeydown' is used two or more times for this component. Parameters must be unique (case-insensitive). The component parameter 'onkeydown' is generated by the '@onkeydown:preventDefault' directive attribute.