Rebind Combobox after disable/enable sequence

3 posts, 1 answers
  1. Aaron
    Aaron avatar
    20 posts
    Member since:
    Jan 2015

    Posted 17 Dec 2015 Link to this post

    Working w/a C# MVC Project that displays a Company's information if the user chosen from a ComboBox EXISTS.  One of the data fields displayed is the Company's State which is itself a ComboBox:

                                .Placeholder("Select a state...")

    Note that when the ComboBox is first created, its data source is bound to the List in "ViewBag.StateNames". 

    When the data is displayed, I DISABLE the "CompanyState" ComboBox as there is no need for the App User to enter the data.

    $("#CompanyState").kendoComboBox({ enabled: false });

    My problem is when I need to ENABLE the "CompanyState", I lose the binding to the List in "ViewBag.StateNames". My question then is: how can I rebind to that List?

  2. Answer
    Nencho avatar
    1446 posts

    Posted 21 Dec 2015 Link to this post

    Hello Aaron,

    Using the approach that you have demonstrated :

    $("#CompanyState").kendoComboBox({ enabled: false });

    You are initializing a new widget, with its enabled state set to false. You can consider using the following approaches for disabling and enabling the kendoComboBox:
    $("#CompanyState").data("kendoComboBox").enable(false// disable
    $("#CompanyState").data("kendoComboBox").enable(true// enable

    This approach is demonstrated in our documentation article below:

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET AJAX banner
  4. Aaron
    Aaron avatar
    20 posts
    Member since:
    Jan 2015

    Posted 21 Dec 2015 in reply to Nencho Link to this post

    Thanks Nencho!
Back to Top