This question is locked. New answers and comments are not allowed.
** UPDATE **
I've cleared this issue by creating a POCO List instead of using the objects from the DB (with EF4)
Is this the only way to use Telerik's Grid with EF4 objects with reference ?)
I see the AJAX call to the controller, and the return has a list inside it.
yet I get 500 Internal error:
What can it be ?
here is the view and controller code:
ItemsInOrder is a EF4 entity that represet a table with compound key (orderID and ItemID)
UPDATE: this is the server response:
but it didn't help. this is what the repository sends back:
var result = (from p in context.ItemsInOrders.Include("Order").Where(i=>i.OrderID == OrderID) select p).ToList();
Help will be appreciated...
On this view
I get
with this controller - I can see the ajax call reaching the controller, and the return has a list with 2 items on it.
it also happens on the rest of the functions... (Insert, delete, Update):
I've cleared this issue by creating a POCO List instead of using the objects from the DB (with EF4)
Is this the only way to use Telerik's Grid with EF4 objects with reference ?)
I see the AJAX call to the controller, and the return has a list inside it.
yet I get 500 Internal error:
What can it be ?
here is the view and controller code:
ItemsInOrder is a EF4 entity that represet a table with compound key (orderID and ItemID)
UPDATE: this is the server response:
I've tried also:The ObjectContext instance has been disposed and can no longer be used for operationsthat require a connection.
[GridAction] public ActionResult SelectItemGridAjax(int OrderID) { return View(new GridModel(ordersRepository.GetOrderItemsTK(OrderID).ToList())); }but it didn't help. this is what the repository sends back:
var result = (from p in context.ItemsInOrders.Include("Order").Where(i=>i.OrderID == OrderID) select p).ToList();
Help will be appreciated...
On this view
<%= Html.Telerik().Grid<ItemsInOrder>() .Name("ItemsInOrderGrid") .DataKeys(dataKeys => { dataKeys.Add(e => e.OrderID); dataKeys.Add(e => e.ItemID); }) .ToolBar(commands => commands.Insert()) .DataBinding(dataBinding => { dataBinding.Ajax() //Ajax binding .Select("SelectItemGridAjax", "Orders", new { OrderID = Model.myOrder.OrderID }) .Insert("InsertItemGridAjax", "Orders", new { OrderID = Model.myOrder.OrderID }) .Update("UpdateItemGridAjax", "Orders") .Delete("DeleteItemGridAjax", "Orders"); }) .Columns(c => { c.Bound(o => o.ItemID); c.Bound(o => o.OrderID).Column.Visible = false; c.Bound(o => o.ItemDescription); c.Bound(o => o.NumOfItems); c.Bound(o => o.CostOfItem); c.Bound(o => o.TotalCost); c.Bound(o => o.SupplyDate); c.Command(commands => { commands.Edit(); commands.Delete(); }).Width(180).Title("?????"); }) %>I get
|
POST SelectItemGridAjax?OrderID=2
http://localhost:6105/Orders/SelectItemGridAjax?OrderID=2
|
500 Internal Server Error
|
with this controller - I can see the ajax call reaching the controller, and the return has a list with 2 items on it.
[GridAction] public ActionResult SelectItemGridAjax(int OrderID) { return View(new GridModel(ordersRepository.GetOrderItemsTK(OrderID))); }it also happens on the rest of the functions... (Insert, delete, Update):
POST InsertItemGridAjax?OrderID=2
http://localhost:6105/Orders/InsertItemGridAjax?OrderID=2
500 Internal Server Error[AcceptVerbs(HttpVerbs.Post)] [GridAction] public ActionResult InsertItemGridAjax(int OrderID) { //Create a new instance of the EditableCustomer class. ItemsInOrder newItem = ItemsInOrder.CreateItemsInOrder(OrderID, ""); newItem.OrderID = OrderID; //Perform model binding (fill the customer properties and validate it). if (TryUpdateModel(newItem)) { //The model is valid - insert the customer. bool res = ordersRepository.InsertItemToOrder(OrderID, newItem); } //Rebind the grid return View(new GridModel(ordersRepository.GetOrderItemsTK(OrderID))); }