Hi Andrey Voronov,
Greetings from Syncfusion support.
The AddAttributes method is used to add multiple attributes depending on the key-value pair to the input element of the textbox. So you can add the maxlength attributes using Dictionary type. We have prepared sample based on your requirement. Please find the code snippet and sample for your reference.
<h4>TextBox</h4>
<EjsTextBox @ref="TextBoxObj"></EjsTextBox>
<button class="e-btn" @onclick="Clicked">Add Attributes</button>
@code
{
EjsTextBox TextBoxObj;
public void Clicked()
{
TextBoxObj.AddAttributes(new Dictionary<string, object>() { { "maxlength", "12" } });
}
}
|
We would like to inform you that we have provided HtmlAttributes. By default, the HtmlAttributes property is available in Textbox. You can add the custom attribute to the textbox input element by using this property.
The following code example demonstrates how to set the custom attribute to the textbox component using HtmlAttributes property.
<h4>TextBox</h4>
<EjsTextBox HtmlAttributes="@htmlAttribute"></EjsTextBox>
@code
{
private Dictionary<string, object> htmlAttribute { get; set; } = new Dictionary<string, object>() {
{"maxlength", "12" }
};
} |
Regards,
Gopi G.