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

Binding a String[] to DropDown in Grid?

Thread ID:





125764 Sep 9,2016 06:01 PM UTC Sep 15,2016 03:08 PM UTC ASP.NET Web Forms 1
Tags: DropDownList
Michael Lambert
Asked On September 9, 2016 06:01 PM UTC

Is it possible to bind just a simple String[] as a datasource for a Dropdown?

                string[] per= { "One", "Two", "Three" };

                var index = this.grdBudget.Columns.FindIndex(col => col.Field == "Period");   //dropdown control
                this.grdBudget.Columns.ElementAt(index).DataSource = per;

                grdBudget.DataSource = new BudgetEntities().Requests.ToList();

PS in this short example I'm assigning 'per' statically but in my application I'll need to assign it dynamically, hence cannot just put the choices in the control def in xml.


Prasanna Kumar Viswanathan [Syncfusion]
Replied On September 15, 2016 03:08 PM UTC

Hi Michael, 
Thanks for contacting Syncfusion support. 
To bind an array of string as a dataSource for dropdown, use the editTemplate property of columns. Use editTemplate property we render the dropdown for particular column and bind the array of string as a datasource for the column. 
Find the code example and sample: 
<ej:Grid ID="OrdersGrid" runat="server" AllowPaging="True" > 
            <EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True"></EditSettings> 
            <ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings> 
<script type="text/javascript"> 
        function create() { 
            return $("<input>"); 
        function write(args) { 
            var obj = $('#<%= OrdersGrid.ClientID %>').ejGrid('instance'); 
            var numbers = ["One", "Two", "Three"]; 
                width: "100%", 
                dataSource: numbers, 
                value: args.rowdata !== undefined ? args.rowdata["CustomerID"] : "" 
        function read(args) { 
            return args.ejDropDownList("getValue"); 
Prasanna Kumar N.S.V 


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

or the page will be automatically redirected to 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