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.
Unfortunately, activation email could not send to your email. Please try again.

Unable to get data from foreign key doropdown list

Thread ID:





128722 Feb 8,2017 12:16 AM Feb 9,2017 04:55 AM ASP.NET Web Forms 1
Tags: Grid
Rob K
Asked On February 8, 2017 12:16 AM


Please, I need help to get a value selected from drop down list(field quickcreditstatusid) and send to my controller when I'm editing one row, below my code from my view:

        .TextWrapSettings(wrap => { wrap.WrapMode(WrapMode.Header); })
        .EditSettings(edit => { edit.AllowEditing(); })
        .ToolbarSettings(toolBar => toolBar.ShowToolbar().ToolbarItems(items =>
        .FilterSettings(filter => { filter.FilterType(FilterType.Excel); })   /*Filtering Enabled*/
        .AllowSorting()    /*Sorting Enabled*/
        .PageSettings(page => { page.PageSize(10); })
        .ScrollSettings(col => { col.Width(1250).Height(380); })
        .Columns(col =>
            col.HeaderText("       ").Commands(command =>
                           .ButtonOptions(new Syncfusion.JavaScript.Models.ButtonProperties()
                               Text = "Commit",
                               Width = "100px",
                               Click = "onClickCommit"
            col.Field("PaymentNumber").HeaderText("Cheque #").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(180).AllowEditing(false).Add();
            col.Field("quickCreditStatus").HeaderText("Bank Validation Status").TextAlign(TextAlign.Right).Width(200).AllowEditing(false).Add();
            col.Field("VersaChequeAmount").HeaderText("Versa Cheque Amount").TextAlign(TextAlign.Right).Width(200).AllowEditing(false).Format("{0:C2}").Add();
            col.Field("BankChequeAmount").HeaderText("Bank Cheque Amount").TextAlign(TextAlign.Right).Width(200).AllowEditing(false).Format("{0:C2}").Add();
            col.Field("BankDate").HeaderText("Bank Date").TextAlign(TextAlign.Right).AllowEditing(false).Width(200).Format("{0:MM/dd/yyyy}").Add();
            col.Field("BMIIssuedDate").HeaderText("BMI Issued Date").TextAlign(TextAlign.Right).AllowEditing(false).Width(200).Format("{0:MM/dd/yyyy}").Add();
<script type="text/javascript">
    function onClickCommit(args) {
        var gridObj = $("#CommandGrid").data("ejGrid");
        //getting corresponding record
        var data = gridObj.getSelectedRecords()[0].PaymentNumber;
        var data1 = gridObj.getSelectedRecords()[0].quickCreditStatusID;
            type: "POST",
            url: "/AdminPaidCheques/CommitPayments",
            //Sending  data to the server(controller) side
            data: { "data": data, "data1": data1 },
            success: function (data) {
                var gridData = ej.parseJSON(data);
                var gridModel = $("#CommandGrid").ejGrid("model");
                $("#CommandGrid").data("ejGrid") !== undefined && $("#CommandGrid").ejGrid("destroy")// destroy the grid if already rendered
                gridModel.query = new ej.Query();//clear the queries
                gridModel.dataSource = gridData;//binding the data to grid  
                //re- render the grid with the changed dataSource



Saravanan Arunachalam [Syncfusion]
Replied On February 9, 2017 04:55 AM

Hi Roberto, 
Thanks for contacting Syncfusion’s support. 
We understood from your query, you need to render the Grid control and perform the CRUD operation on it and we suggest you to use the remoteSaveAdaptor of DataManager to achieve your requirement. Please refer to the below code example. 
<ej:Grid ID="Grid1" AllowPaging="True" runat="server"> 
        . . . 
public partial class GridFeatures : System.Web.UI.Page 
        protected void Page_Load(object sender, EventArgs e) 
            this.Grid1.DataManager = new DataSource() { Json = OrderRepository.GetAllRecords(),  
               Adaptor = "remoteSaveAdaptor", 
               InsertURL = "GridFeatures.aspx/Insert", 
               RemoveURL = "GridFeatures.aspx/Remove",  
               UpdateURL="GridFeatures.aspx/Update" }; 
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)] 
        public static object Update(EditableOrder value) 
            OrderRepository.Update(value); //To update the record 
            return value; 
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)] 
        public static object Insert(EditableOrder value) 
            OrderRepository.Add(value); //To add a new record 
            return value; 
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)] 
        public static void Remove(int key) 
            OrderRepository.Delete(key); //To delete a record 
And we have created sample that can be downloaded from the below link. 
Saravanan A. 


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.

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.