Hi All,
I am using Telerik MVC Grid and performing an Ajax Binding. Below is the code in my CSHTML file.
@(Html.Telerik().Grid(Model.customer)
.Name("GridCustomer")
.DataKeys(keys => keys.Add(doc => doc.CustId))
.ToolBar(commands => commands.Insert().ImageHtmlAttributes(new { style = "margin-left:0" }))
.DataBinding(dataBinding =>
{
dataBinding.Ajax()
.Update("Update", "Test")
.Delete("Delete", "Test")
.Insert("Insert", "Test");
})
.Columns(columns =>
{
//columns.Bound(doc => doc.CustId).Template(@<text> @Html.Telerik().DropDownList().Name("ddl").BindTo(new SelectList(Model.ToList(), "CustId", "CustName"))</text>);
columns.Bound(doc => doc.CustName);
columns.Bound(doc => doc.CustCity).Width(100);
columns.Bound(doc => doc.CustAddress).Width(150);
columns.Command(commands => { commands.Edit(); });
columns.Command(commands => { commands.Delete(); });
})
.Editable(editing => editing.Mode(GridEditMode.InLine))
)
In Controller I have my Grid Action.
[AcceptVerbs(HttpVerbs.Post)]
[GridAction]
public ActionResult Insert(FormCollection frmcl)
{
// Insert code goes here //
}
Now, I have a string value to check if the Insert is success or fail. This value comes from my Data Access layer(Service). I have a property for this(in my Model)
I want to show this message in my view.It may be displayed as a Label or a popup. But since the GridAction does not refresh the entire view,I am unable to pass the string message.
In this scenario, I cannot use a JSONResponse as its a GridAction.
I even tried placing my Grid in a Partial View and using the following code :
@model TelerikMvcApplication2.Models.Example
@{
ViewBag.Title = "Index";
}
<h2>
Index</h2>
@Html.LabelForModel(Model.errorMessage)
@Html.Partial("_resultSet");
Please suggest how to solve this issue.
Please let me know if there is a work-around for this.
Thanks in advance.