I am trying to create a textbox that has the following features
Hi Enrique,
We suggested SfNumericTextbox to achieve your requirement. Please find the code snippet and sample attached for your reference.
<SfNumericTextBox TValue="int?" HtmlAttributes="@CustomAttribute"> </SfNumericTextBox> @code{ Dictionary<string, object> CustomAttribute = new Dictionary<string, object>() { { "maxlength", "9" } }; }
|
Sample: https://blazorplayground.syncfusion.com/hNrgCtsdoqtMXoVp
For more information, Please refer the below demos and documentation:
https://blazor.syncfusion.com/demos/numeric-textbox/default-functionalities?theme=fluent
https://blazor.syncfusion.com/documentation/numeric-textbox/getting-started
If the information provided does not fully meet your requirements or if you have any specific issues you'd like to address, please share additional details with us. We are here to assist you further.
Regards,
Priyanka K
Hi,
I tried using a numeric box, but the formatting of it removes any zeros. It turns “000910” to “910”.
The values I am using need to behave like numeric strings. Kind of like a phone number or an ID Number.
Hi, any ideas regarding my reply above?
Hi Enrique,
To achieve your desired functionality, you can make use of the PromptChar property with the SfMaskTextBox component.
|
<SfMaskedTextBox Mask="000000000" PromptChar="@promptChar"></SfMaskedTextBox> @code{ public char promptChar = ' '; } |
Sample: https://blazorplayground.syncfusion.com/VNrgWjhQIBnhvouj
Documentation: https://blazor.syncfusion.com/documentation/input-mask/mask-configuration#prompt-character
Regards,
Mallesh