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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid - DropDown

Thread ID:

Created:

Updated:

Platform:

Replies:

129778 Apr 3,2017 11:51 AM UTC Apr 4,2017 11:59 AM UTC ASP.NET Web Forms 1
loading
Tags: Grid
Danie van Eeden
Asked On April 3, 2017 11:51 AM UTC

Hi,

I've been trying to figure this out from the documentation, but have been unable to:

Is it possible to add your own data to a DropDownList that is being used within a Grid.

eg. Can I add custom data to the dropdown below?
<ej:Grid ID="FlatGrid" runat="server" AllowPaging="True">
           <EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True" EditMode="Normal"></EditSettings>
           <ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings>
           <Columns>
                <ej:Column Field="ShipCountry" EditType="Dropdown"/>

Alan Sangeeth S [Syncfusion]
Replied On April 4, 2017 11:59 AM UTC

Hi Danie, 

Thanks for using Syncfusion products. 
You can set your own data to a DropdownList EditType Column in code behind using “DataSource” property of Grid column. Please refer the following code example. 

protected void Page_Load(object sender, EventArgs e) 
        { 
 
var colData  = new NORTHWNDEntities().Orders.Select(ds =>ds.ShipCountry).Distinct().ToList(); 
            List<object> dataPair = new List<object>(); 
           for (var i = 0; i < colData.Count; i++) 
           { 
               dataPair.Add(new {text = colData[i], value = colData[i]}); 
           } 
               this.EmployeesGrid.Columns.ElementAt(index).DataSource = dataPair; 
        } 

Note: We need to bind datasource for dropdown column as text and value pair. 

We have created a sample based on your requirement that can be downloadable from below link 


Regards,
Alan Sangeeth S 


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.

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

;