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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

ejDropDownList column datasource from ashx

Thread ID:

Created:

Updated:

Platform:

Replies:

143845 Apr 8,2019 01:52 AM UTC Apr 9,2019 11:04 AM UTC jQuery 3
loading
Tags: ejGrid
jeff
Asked On April 8, 2019 01:52 AM UTC

Hi, 

Could you give a sample that use the ejGrid & ejDropDownList use Datasource from ashx





Vignesh Natarajan [Syncfusion]
Replied On April 8, 2019 12:52 PM UTC

Hi Jeff, 

Thanks for contacting Syncfusion Support. 

Query: “Could you give a sample that use the ejGrid & ejDropDownList use Datasource from ashx 

From your query, we understand that you need to bind dataSource to Grid from ashx handler and perform CRUD action with dropdownlist in one of the column. We have used UrlAdaptor to bind dataSource from ashx page. Refer below link for the sample 


If your requirement is different from above solution, please share us the following details. 

  1. Do you need to bind different dataSource for dropdownList different from Grid data?
  2. Do you want to bind only dropdown dataSource alone from ashx page?
  3. Detail Explanation of exact scenario you need to achieve.
 
Requested details will be helpful for us to validate the reported query at our end. 
 
Regards, 
Vignesh Natarajan. 
 


jeff
Replied On April 8, 2019 06:43 PM UTC

Hi,

I want to use the dropdownlist in ejgrid , dropdownlist datasource use the ashx to get json data, Could U give me the sample,
ejgrid datasource & dropdown list  are different datasource

Many Thanks

Vignesh Natarajan [Syncfusion]
Replied On April 9, 2019 11:04 AM UTC

Hi Jeff,  
 
Query: “ Could U give me the sample,ejgrid datasource & dropdown list  are different datasource 
 
As per your requirement, we have prepared a sample by binding different dataSource to dropdownlist from ashx handler. Refer the below code example 
 
<script type="text/javascript"> 
        var ddldata; 
        $(function () { 
 
            // dataSource for Grid 
            var dataManager = ej.DataManager({ 
                url: "Handler/Data.ashx", 
                adaptor: new ej.UrlAdaptor() 
            }); 
 
            // dataSource for Dropdown element 
            var ddldataManager = ej.DataManager({ 
                url: "Handler/ddlData.ashx", 
                adaptor: new ej.UrlAdaptor() 
            }); 
 
            var query = ej.Query().take(5); 
            var execute = ddldataManager.executeQuery(query) // executing query 
                .done(function (e) { 
                    ddldata = e.result; // store the value from ashx in global variable 
                }); 
            var query = ej.Query().take(5); 
            var execute = dataManager.executeQuery(query) // executing query 
                .done(function (e) { 
 
                    // bind the dropdown dataSource from the global varibale 
                    $("#Grid").ejGrid({ 
                        dataSource: e.result, 
                        editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true }, 
                        toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Edit, ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] }, 
                        allowPaging: true, 
                        columns: [{ field: "OrderID", isPrimaryKey: true }, 
                        { field: "CustomerID" }, 
                        { field: "EmployeeID", editType: ej.Grid.EditingType.Dropdown, dataSource: ddldata, editParams: { fields: { text: "EmployeeID", value: "EmployeeID" }, enableDistinct: true } }, 
                        { field: "ShipCity" } 
                        ], 
                        ………………………………………………………………………… 
 
                    }); 
                }); 
 
 
        }); 
 
Note: in the dataManager done function we have stored the value in global variable and bind that dataSource to dropdownlist inside the Grid column using editParams.  
 
Refer the below screenshot for the output 
 
 
 
 
For your convenience we have attached the sample which can be downloaded from below link 
 
 
Run the sample.html by opening it in the visual studio. 
 
Please get back to us if you have further queries. 
 
Regards, 
Vignesh Natarajan. 
 


CONFIRMATION

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

Live Chat Icon For mobile
Live Chat Icon