How to manually initialize AutoComplete while loading instead of automatic loading.

3 posts, 0 answers
  1. Daniel
    Daniel avatar
    16 posts
    Member since:
    Feb 2013

    Posted 08 Jul 2013 Link to this post

    Hello,

    I am using Auto complete inside a form. When the form returns Kendo UI AutoComplete remembers the last input value and fills it in. But I would like to initialize it manually (in the code) instead. I tried setting the value to a variable but failed. Setting Autobind(false) did not work either.

    Can you give me an example in Razor please?

    I also like to do the same for dropdownlist and datepicker.

    Thanks,

  2. Daniel
    Admin
    Daniel avatar
    2118 posts

    Posted 10 Jul 2013 Link to this post

    Hello Daniel,

    By default when posting a form, the value will be populated from the ModelState. If you wish to avoid this then you should remove the key for the autocomplete property from the ModelState. For example:

    [HttpPost]
    public ActionResult Index(ViewModel model)
    {
        ModelState.Remove("AutoCompleteFieldName");
    Regards,
    Daniel
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Daniel
    Daniel avatar
    16 posts
    Member since:
    Feb 2013

    Posted 10 Jul 2013 Link to this post

    Yes that works. "AutoCompleteFieldName" is the name that is assigned for the control (in the view in MVC)

    Thanks,
Back to Top