Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
290
Required combo
posted

Hi,

I would like to use a "Required option" when using "@Html.ComboFor" helper.

I would like a message displaying when the form is submited and no value is selected in the Combo, something working like the validation of the textEditor when the field is required.

There is no "required" option in the combo helper. So How can I achieve this ?

Thanks.

Parents
  • 4315
    Verified Answer
    Offline posted

    Hi, PEO-Stokomani.

    You can use instead the ValidatorOptions wrapper. I hope the code below will help you:

    Code Snippet
    1. @(Html.Infragistics().ComboFor(item => item.EmployeeID)
    2.     .ValueKey("ID")
    3.     .TextKey("Name")
    4.     .ValidatorOptions(option => {
    5.         option.Required(true);
    6.     })
    7.     .DataBind()
    8.     .Render()
    9. )

    For any further questions about the igCombo you can use the section for the control in our forum. Thank you for using our product!

    Best regards,

    Nikolay Alipiev

Reply Children
No Data