ComboBox completion limit to items

Posted by: fsegui on 24 March 2022, 11:18 am EST

    • Post Options:
    • Link

    Posted 24 March 2022, 11:18 am EST

    Hi,

    I’m using a C1ComboBox that is binded to a datasource.

    Therefore, I’m setting TranslateValue & TextDetached property to true.

    I’ve also set the properties :

     
    combo.DropDownStyle = C1.Win.C1Input.DropDownStyle.Default
    combo.AutoCompleteMode = AutoCompleteMode.SuggestAppend
    combo.AutoCompleteSource = AutoCompleteSource.ListItems
    
    

    I want the user to only select or type a value from the list.

    I’ve searched in the docs, but with translateValue/textDetached property to true, I cannot use the prevalidation. How can I prevent the user to type text and limit to the values from the datasource?

    Thanks,

    Best regards

  • Posted 24 March 2022, 11:30 am EST

    Another question: completion works only with the beginning of the text.

    For example, I’ve a list composed of

    • John Doe
    • Sylvester Stallone

      If I type “Joh” => completion propose “John Doe”

      If I type “Doe” => completion propose nothing.
  • Posted 25 March 2022, 7:28 am EST

    Hi Florent,

    You can use the Validating event of the C1ComboBox to call the PreValidation.Validate method which will validate the user input according to the rules defined in the PreValidation.

    To search from the Items using the contains criteria, You can set the AutoSuggestMode property of the C1ComboBox to AutoSuggestMode.Contains. Kindly refer to the attached sample showing the same.

    Best Regards,

    Kartik

    Validation_C1CMB.zip

  • Posted 28 March 2022, 7:49 am EST

    Hi Kartik,

    Thanks for your sample. I’ve made it work.

    Best regards

    Florent

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels