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? 

Parents
No Data
Reply
  • 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://ko.infragistics.com/help/aspnet/webdropdown-autocomplete-and-auto-filtering

     

    Hope this helps

    ROB

Children
No Data