This question is locked. New answers and comments are not allowed.
Hello,
I have been attempting to pass two values to my controller from my update and delete commands on my grid.
I have been unable to figure out how to get the current value from the editable grid row to be passed as the value to the controller.
The examples show <#= OrderKey #> as the syntat to use as the use to accomplsh the task but it is passed as plain text.
Would Like Value From Row is where I would like to row value
Any help?
Here is an example of my grid as well as my controller. I am using Razor Syntax.
<div>
@{Html.Telerik().Grid(Model.Designs).Name("orderDesignModel").PrefixUrlParameters(false)
.DataKeys(dataKeys =>
{
dataKeys.Add(c => c.Key).RouteKey("Key");
dataKeys.Add(c => c.OrderKey);
})
.ToolBar(commands => commands.Insert())
.DataBinding(dataBinding => dataBinding
.Ajax()
.Select("IndexOrderDesignModel", "Order")
.Insert("InsertOrderDesignModel", "Order")
.Update("UpdateOrderDesignModel", "Order", new { mainId = Model.Key, subId = "Would Like Value From Row" })
.Delete("DeleteOrderDesignModel", "Order", new { mainId = Model.Key, subId = "Would Like Value From Row" }) )
.Columns(columns =>
{
columns.Add(c => c.Key).Hidden();
columns.Add(c => c.Name).Width(200);
columns.Add(c => c.Description);
columns.Add(c => c.DueDate);
columns.Add(c => c.DeliveryAddress);
columns.Add(c => c.ShippedDate);
columns.Command(commands => commands.Edit());
columns.Command(commands => commands.Delete());
})
.Filterable()
.Sortable(sort => sort.SortMode(GridSortMode.MultipleColumn))
.Pageable()
.Scrollable(scrolling => scrolling.Height(250))
.Render();}
</div>[HttpPost]
[GridAction(GridName = "orderDesignModel")]
public ActionResult UpdateOrderDesignModel(string mainId, string subId)
{
//Removed Extra Text
return View(new GridModel(_orderRepository.All()));
}