We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Setting the selected property in a dropdown control when editing a record using a Dialog form.

Thread ID:





123343 Mar 9,2016 05:34 AM UTC Mar 10,2016 01:52 PM UTC ASP.NET MVC 1
Tags: Grid
Mahindra Morar
Asked On March 9, 2016 05:34 AM UTC


I am trying to set the selected property on a dropdown control when editing an existing record in a grid control. 

When the Dialog form is shown, I make an ajax call to the controller to populate the dropdown control using these grid events  if (args.requestType == "beginedit" || args.requestType == "add")
After the control is loaded, I execute the following code.

  $("#CountryCode").find("option:contains('GBR')").each(function ()
                        if ($(this).text() == 'GBR')
                            $(this).attr("selected", "selected");

The dropdown control does not show any text in the dropdown area. However when clicking on the control I can select from the values added from the ajax call.

Is there something obvious I am doing something wrong.

Thanks fro your help.

Venkatesh Ayothi Raman [Syncfusion]
Replied On March 10, 2016 01:52 PM UTC

Hi Mahindra,

Thanks for using Syncfusion product.

We have achieved your requirement ”Bind a new datasource to dropdownlist while editing or adding” using actionComplete event. If we add or edit a record then it bind a new datasource for dropdown list through AJAX call to the controller. We gave a default selected value for dropdown using selectItemByValue method in dropdown control. We have created a sample and refer to the code example,
Code Example:

<View page and Ajax call>

<script type="text/javascript">

    function actionComplete(e) {


        if (e.requestType == "beginedit" || e.requestType == "add") { //AJAX method call


                url: "/Grid/Getlist",

                method: "POST",

                success: function (list) {


                    var obj = $("#FlatGridShipName").data("ejDropDownList");

                    $("#FlatGridShipName").ejDropDownList({ dataSource: list });

                    obj.selectItemByValue("Argus"); //Set a value for Dropdown List while editing or Adding







Venkatesh Ayothiraman.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon