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

ejGrid, edit template fill a dropdown from a different source

Thread ID:

Created:

Updated:

Platform:

Replies:

121592 Jan 5,2016 05:06 PM UTC Jan 7,2016 08:51 AM UTC ASP.NET Web Forms 3
loading
Tags: Grid
Bruce Stevenson
Asked On January 5, 2016 05:06 PM UTC

we are using Version=12.3400.0.36 of the ej:Grid, when editing I need one of the dropdowns to have values filled at page load with values for the users allowed to have.

I found a simple example from one of the Forum posts so I tried this:
private void BindDataSource()
{
    bike.Add(new Bikes(1, "Harley"));
    bike.Add(new Bikes(2, "Indian"));
    bike.Add(new Bikes(3, "Honda"));

    int code = 10000;
    for (int i = 1; i < 10; i++)
    {
order.Add(new Orders(code + 1, "ALFKI", i + 0, 2.3 * i, new DateTime(1991, 05, 15), "Berlin"));
order.Add(new Orders(code + 2, "ANATR", i + 2, 3.3 * i, new DateTime(1990, 04, 04), "Madrid"));
order.Add(new Orders(code + 3, "ANTON", i + 1, 4.3 * i, new DateTime(1957, 11, 30), "Cholchester"));
order.Add(new Orders(code + 4, "BLONP", i + 3, 5.3 * i, new DateTime(1930, 10, 22), "Marseille"));
order.Add(new Orders(code + 5, "BOLID", i + 4, 6.3 * i, new DateTime(1953, 02, 18), "Tsawassen"));
code += 5;
    }
    this.FlatGrid.DataSource = order;

    var index = this.FlatGrid.Columns.FindIndex(col => col.Field == "Delivery");
    this.FlatGrid.Columns.ElementAt(index).DataSource = bike;

    this.FlatGrid.DataBind();
}

there where no aspx changes noted.
when I ran the code I got:
JavaScript runtime error: DataManger : a dataSource is required to create Manager
Error: DataManger : a dataSource is required to create Manager
   at u (http://localhost:60455/Scripts/ej/ej.web.all.min.js:10:69085)
   at t.DataManager (http://localhost:60455/Scripts/ej/ej.web.all.min.js:10:18935)
   at t.DataManager (http://localhost:60455/Scripts/ej/ej.web.all.min.js:10:18900)
   at complete (http://localhost:60455/Default.aspx:131:17)
   at t.widgetBase._trigger (http://localhost:60455/Scripts/ej/ej.web.all.min.js:10:8510)

I do not see any example using a list or other local data binding in this way.

Thanks;

Attachment: Grid_a6959885.zip

Sellappandi Ramu [Syncfusion]
Replied On January 6, 2016 09:55 AM UTC

Hi Bruce,

Thanks for contacting Syncfusion support.

We have tested the reported issue in provided sample and found that you have not properly rendered dataSource to dropdown list, the server data for dropdown is defined as “BikeID”  and “Text” pair which is the cause of the issue. While binding data to dropdown list, data should be “text” and “value” pair. And While using dialog template datasource should set for dropdown in actionBegin event.

Please refer to the code example,


if (args.requestType == "beginedit") {

                    $("#OrderID").attr("disabled", "disabled");

                    $("#ShipCity").ejDropDownList({ width: '116px', change: "_Change" }).ejDropDownList("setSelectedValue", args.row.children().eq(5).text());

                   

                    //var gobj = $("#Agacent").ejGrid("instance")

                    //gobj.gridObj.dataSource(data);


                    $("#Agacent").ejDropDownList({ width: '116px', dataSource: this.model.columns[6].dataSource }).ejDropDownList("setSelectedValue", args.row.children().eq(6).text());

                }

                else

                    $("#ShipCity").ejDropDownList({ width: '116px', change: "_Change" });

               

            }

[Server side]

[Serializable]

        public class Bikes

        {

            public Bikes()

            {


            }

            public Bikes(long Bike, string text)

            {

                this.value = Bike;

                this.text = text;

            }

            public long value { get; set; }

            public string text { get; set; }
        }


Regards,
Sellappandi R

Bruce Stevenson
Replied On January 6, 2016 01:53 PM UTC

thank you  for identifying the datasource it has fixed the issue.
I have made the changes to the class and now see the data for selection.


again Thanks for the support.



Sellappandi Ramu [Syncfusion]
Replied On January 7, 2016 08:51 AM UTC

Hi Bruce,

Thanks for the update.

Please get back to us if you have any queries. We are happy to assist you.

Regards,
Sellappandi R

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

;