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
320
Datasource in dropdown
posted

Two issues.  If I set my datasource in the c# code behind and I can't seem to get the autocomplete to work.  Also If I do set the datasource there can I use client side autocomplete so I don't need to post back everytime I type into the dropdown? 

  • 215
    posted

    The EnableAutoFilter property can be used to limit the visible items in the dropdown area to those that start with the text entered into the WebDropDown (the textbox above the dropdown list).  Here is an example of how to set the properties programmatically for the WebDropDown control wdd.

    'setup control
    wdd.DisplayMode = Infragistics.Web.UI.ListControls.DropDownDisplayMode.DropDown
    wdd.EnableAutoCompleteFirstMatch = True
    wdd.EnableAutoFiltering = Infragistics.Web.UI.ListControls.AutoFiltering.Client
    'setup data binding
    wdd.TextField = "Title"
    wdd.ValueField = "Value"
    wdd.DataSource = source
    wdd.DataBind()

    Of course, the properties could have been setup in the .aspx file

    Note the following...

    • DisplayMode must equal "DropDown" (you can't type into the textbox of the control otherwise)
    • EnableAutoFiltering="Client" is the key to having the client do the filtering
    • EnableAutoCompleteFirstMatch="true" does the autocomplete.  If set to "false", then the dropdown will still be filtered but you will need to click on an item to select it.

    Advanced Stuff...

    • By default, filtering is done on a "StartsWith" basis.  That is, when you type the letter "a", all of the items that begin with the letter "a" are displayed.  However you can change this behavior by setting the AutoFilterQueryType.  Possible values are (StartsWith, EndsWith, Contains, DoesNotContain, Equals, DoesNotEqual).  "Contains" offers some interesting possibilities.
    • You can change the order that the filtered items are displayed using the AutoFilterSortOrder property.
    • You can also change the maximum number of items displayed using the AutoFilterResultSize property.

    More Information: https://es.infragistics.com/help/aspnet/webdropdown-autocomplete-and-auto-filtering

     

    Hope this helps

    ROB

  • 24671
    posted

    Hi,

    Could you be a bit more specific - do you rebind every time ? Where do you set the data source? If you can show me your code behind and ASPX code i will be glad to help. When you say auto complete doesn't work, do you mean that when you type something and you have EnableAutoFiltering=Server , it doesn't filter the items list , or something else happens?

    About your second question - yes , client-side autocomplete doesn't do any postback. it's fully on the client and is operating on the initially fetched list of items.

    hope this helps,

    Angel