MVCxCardViewEditingSettings.UpdateCardRouteValues Property
Defines the callback routing logic by specifying the names of a Controller and an Action which should handle callbacks related to row updates.
Namespace: DevExpress.Web.Mvc
Assembly: DevExpress.Web.Mvc5.v24.1.dll
NuGet Package: DevExpress.Web.Mvc5
Declaration
Property Value
Type | Description |
---|---|
Object | An object containing the Controller and Action names. |
Property Paths
You can access this nested property as listed below:
Object Type | Path to UpdateCardRouteValues |
---|---|
CardViewSettings |
|
MVCxCardView |
|
Remarks
If card editing is allowed for CardView, you should provide an associated controller action that will apply update operations to the Model and return the CardView’s partial view. Use the UpdateCardRouteValues property to reference this controller action by its name and the name of its controller.
Note that in an action that handles update operations, you can obtain the edited object using our specific DevExpressEditorsBinder model binder.
View (CardViewPartial):
var CardView = Html.DevExpress().CardView(
settings =>
{
settings.Name = "cvEditing";
settings.KeyFieldName = "ProductID";
settings.CallbackRouteValues = new { Controller = "CardView", Action = "CardViewPartial" };
...
settings.SettingsEditing.UpdateCardRouteValues = new { Controller = "CardView", Action = "CardViewUpdatePartial" };
...
CardView.Bind(Model).Render();
Controller (‘CardViewController’):
public partial class CardViewController : Controller {
...
public ActionResult CardViewPartial() {
return PartialView("CardViewPartial", NorthwindDataProvider.GetEditableProducts());
}
...
[HttpPost]
public ActionResult CardViewUpdatePartial([ModelBinder(typeof(DevExpressEditorsBinder))] EditableProduct product) {
if(ModelState.IsValid) {
try {
NorthwindDataProvider.UpdateProduct(product);
}
catch(Exception e) {
ViewData["EditError"] = e.Message;
}
}
else
ViewData["EditError"] = "Please, correct all errors.";
return PartialView("CardViewPartial", NorthwindDataProvider.GetEditableProducts());
}
...