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

Edit GRID Row

Thread ID:





128423 Jan 20,2017 01:51 PM UTC Jan 23,2017 12:33 PM UTC ASP.NET Core 1
Tags: Grid
Nicholas Picardi
Asked On January 20, 2017 01:51 PM UTC

Hi all,

It's possible create a cascading dropdownlist populate with a stored procedure in the edit of the row?

These are my two ddl in edit:

col.Field("MA_StatusCode").HeaderText("Reallocated status code").AllowEditing(true).EditType(EditingType.Dropdown).DataSource((List<object>)ViewBag.alarms).ForeignKeyField("MA_StatusCode").AllowResizing().Width(150).Add();

col.Field("FullDescription").HeaderText("Reallocated Full Description").EditType(EditingType.Dropdown).DataSource((List<object>)ViewBag.FullAlarm).ForeignKeyField("FullDescription").AllowResizing().Width(400).Add();

It's possible?


Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On January 23, 2017 12:33 PM UTC

Hi Nicholas, 
Thanks for contacting Syncfusion Support.  
The Column dataSource will accept only the list of text/value pair as an input. So we suggest to convert the StoredProcedure result to the list of text/value pair and assign them to the corresponding column. Refer to the following code example and API reference. 
        public IActionResult Index() 
            String strConnString = ConfigurationManager.ConnectionStrings["NORTHWNDConnectionString"].ConnectionString; 
            SqlConnection con = new SqlConnection(strConnString); 
            SqlCommand cmd = new SqlCommand(); 
            cmd.CommandType = CommandType.StoredProcedure; 
            cmd.CommandText = "Shipping"; 
            cmd.Connection = con; 
            List<object> dropObj = new List<object>(); 
            using (SqlDataReader dr = cmd.ExecuteReader()) 
                while (dr.Read()) 
                    //Convert them to text/value pair 
                    dropObj.Add(new { text = dr.GetValue(0).ToString(), value = dr.GetValue(0).ToString() }); 
            ViewBag.dropObj = dropObj; 
            ViewBag.GridData = new NorthwindDataContext().OrdersViews.ToList(); 
            return View(); 
            .Columns(col => 
                        .. .  
                            .. .  
                    //Dropdown column 
                    col.Field("ShipCountry").HeaderText("Ship Country") 
Note: In this, we have read the Shipping a Stored Procedure and bind ShipCountry column as a text/value pair input to the DropDown DataSource.  
We could also have noticed that you have used the foreignkey in your code example but you have missed a ForeignKeyValue API for the corresponding column. To Render the ForeignKey column ForeignKeyValue, ForeignKeyField and DataSource are important for a column. Refer to the following code example and help Documents. 
            .Columns(col => 
                        .. . 
                              . . . 
                    //ForeignKey column 
                    col.Field("EmployeeID").HeaderText("Employee Name") 
Seeni Sakthi Kumar S. 


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