Telerik ASP.NET MVC2 Grid Delete Function with compound key.
- by Dani
I have a grid with a compound key: OrderId, ItemID.
When I update the grid - the
public ActionResult UpdateItemGridAjax(int OrderID, string ItemID) Gets both values from the grid.
When I delete a row I get only the first one:
public ActionResult DeleteItemGridAjax(int OrderID, string ItemID)
Why is it happens and how can I get the ItemId value of the deleted row ?
Grid Definition:
<%=
Html.Telerik().Grid<ItemsInOrderPOCO>()
.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("Upadte");
})