Set DropDownList SelectedName with AngularJS

3 posts, 0 answers
  1. Jayme
    Jayme avatar
    17 posts
    Member since:
    Jun 2014

    Posted 09 Nov 2015 Link to this post

    I have a drop down list that gets populated with a CompanyID and CompanyName:


      <select id="MerchantList" kendo-drop-down-list="MerchantList" ng-model="MerchantID" k-options="populateCompanies" class="form-control" required validationmessage="Please select a company"></select>​​


     //populate the kendo drop down control
        $scope.populateCompanies = {
            dataSource: merchantDataSource,
            dataTextField: "CompanyName",
            dataValueField: "MerchantID",
            //optionLabel: "Please Select Your Company",
            filter: "contains",
            minLength: 3

    I also have a user record that contains the CompanyName: $scope.user.CompanyName

    How do I select the CompanyName in the drop down list?  

    Many thanks,



  2. Konstantin Dikov
    Konstantin Dikov avatar
    1750 posts

    Posted 10 Nov 2015 Link to this post

    Hi Jayme,

    The requirement that you have could not be easily achieved, because the selected will be performed based on the value of the DropDownList items and not the text. Nevertheless, you can use the approach from the following dojo example to manually find and select an item by its text:
    Hope this helps.

    Konstantin Dikov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Jayme
    Jayme avatar
    17 posts
    Member since:
    Jun 2014

    Posted 11 Nov 2015 in reply to Konstantin Dikov Link to this post

    Thank you for taking the time to reply. This doesn't quite fit the scenario where I want to preset the drop down to the text on initial load, however.  If you remove the ProductID and set the productnametoselect initially, it isn't selected.

    This can be accomplished in both JQUERY and .NET code, so I was assuming there would be something simliar built into the Kendo Drop DownList.  Examples:


    var theText = "Apples";
    $("#ddlFruit option").each(function() {
    if($(this).text() == theText) {
                $(this).attr('selected', 'selected');            

    I appreicate you letting me know this isn't really built into the kendo drop down control. I thought I was missing something easy.  For now, I display the current company for the user and prompt the user to switch to a different company in the drop down box if they want to change it.  Not ideal, but it works.



Back to Top