BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
@(Html.EJ().Grid<Object>("FlatGrid") .Datasource(ds => { ds.URL("/Grid/DataSource").Adaptor(AdaptorType.UrlAdaptor).UpdateURL("/Grid/Update"); }) .AllowScrolling() .AllowPaging() .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); }) .Columns(col => { col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add(); col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add(); col.Field("EmployeeID").HeaderText("Employee ID").DataSource(ViewBag.dataSource2).EditType(EditingType.Dropdown).TextAlign(TextAlign.Right).Width(75).Add(); col.Field("Freight").HeaderText("Freight").Add(); public ActionResult GridFeatures() { List<dropDown> list = new List<dropDown>(); list.Add(new dropDown(1, "1")); list.Add(new dropDown(2, "2")); . . . . list.Add(new dropDown(9, "9")); ViewBag.dataSource2 = list; return View(); } public ActionResult DataSource(DataManager dm) {
IEnumerable DataSource = OrderRepository.GetAllRecords(); . . . . . return Json(result, JsonRequestBehavior.AllowGet); } public class dropDown { public string text { get; set; } public int value { get; set; } public dropDown() { } public dropDown(int val, string txt) { this.text = txt; this.value = val; } |
List<dropDown> list = new List<dropDown>();
Thank you Alan Sangeeth S.I switched to foreign key. Now it works correctly, but is random. See the video attached please.This is the code I'm using://Impianto, dropdowncol.Field("ImpiantoID").HeaderText("Impianto").ForeignKeyField("id_impianto").ForeignKeyValue("Nome").DataSource((IEnumerable<Impianto>)ViewBag.listaImpianti).EditType(EditingType.Dropdown).TextAlign(TextAlign.Center).Width(150).Add();//Zona, dropdowncol.Field("ZonaID").HeaderText("Zona").ForeignKeyField("id_zona").ForeignKeyValue("Nome").DataSource((IEnumerable<Zona>)ViewBag.listaZone).EditType(EditingType.Dropdown).TextAlign(TextAlign.Center).Width(100).Add();As you can see in the video attached, sometimes the value selected is correct, and sometimes not.I created a test project to check if is the same with a static datasource (instead of database) and it works correctly. The class used in the test project are the same of the originale project.What could cause this problem?Some other column of the table?
List<object> list = new List<object>(); //metaobject list.Add(new { EmployeeID1 = 1, Name = "John" }); list.Add(new { EmployeeID1 = 2, Name = "11/2" }); . . . .. list.Add(new { EmployeeID1 = 9, Name = "Joh8" }); ViewBag.dataSource2 = list; List<dropDown> drop = new List<dropDown>(); //Business objects drop.Add(new dropDown(1, "Johh")); . . . . . drop.Add(new dropDown(9, "Johh8")); |
Please log on to our support website to check for further updates.
https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents
Regards,
Gowthami V.