1
我有一個複合鍵的網格:OrderId,ItemID。 當我更新網格時 - public ActionResult UpdateItemGridAjax(int OrderID, string ItemID)
從網格中獲取這兩個值。Telerik ASP.NET MVC2使用複合鍵的網格刪除功能
當我刪除行我只得到了第一個:
public ActionResult DeleteItemGridAjax(int OrderID, string ItemID)
爲什麼發生,我怎樣才能刪除行的項目Id值?
電網定義:
<%=
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");
})
對自己的評論。我見過至少有一次這段代碼在刪除時不起作用,我仍然得到OrderID和id(而不是ActivityID) – Dani 2011-01-20 19:52:00