Hi.
I currently have the following Model:
I currently have a following partial view with a grid.
The custom command calls the following Javascript function "manageUser" defined as follows:
My Controller is as follows:
I would like the View to render with the AwesomeDTO properties. The step where I am not quite understanding is when and how to call the ManageAwesome view so that it renders in a new location in the browser. I do not want to expose the ID of the AwesomeDTO in the URL string and so I am looking for an alternative way to achieve this from the Kendo Grid.
Any help would be appreciated.
Thanks,
Navin
I currently have the following Model:
public class AwesomeDTO
{
public string ID {get;set;}
public string Name {get;set;}
public string Description {get;set;}
}
@model IEnumerable<
AwesomeDTO
>
@(Html.Kendo().Grid(Model)
.Name("AwesomeGrid")
.Columns(columns =>
{
columns.Bound(u => u.Name).Title("Name").Filterable(true).Width(200);
columns.Bound(u => u.Description).Title("Description").Filterable(false).Width(200);
columns.Command(command => command.Custom("Manage").Click("manageUser").Text("Manage")).Title("Manage");
}
)
.Pageable()
.Filterable(filter => filter.Enabled(true))
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.PageSize(10)
.Model(model => model.Id(u => u.ResourceID))
.Events(events => events.Error("onError"))
.Read(read => read.Action("GetAwesome", "Awesome"))
)
)
The custom command calls the following Javascript function "manageUser" defined as follows:
function manageUser(e) {
e.preventDefault();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var result;
debugger;
$.ajax({
url: '@Url.Action("ManageAwesoem", "Awesome")',
type: 'POST',
data: JSON.parse(JSON.stringify(dataItem)),
content: 'text/html',
success: function (data) {
alert(data);
},
error: function (data) {
alert('error:' + data);
}
});
}
My Controller is as follows:
public ActionResult ManageAwesome(AwesomeDTO userToManage)
{
return View(userToManage);
}
I would like the View to render with the AwesomeDTO properties. The step where I am not quite understanding is when and how to call the ManageAwesome view so that it renders in a new location in the browser. I do not want to expose the ID of the AwesomeDTO in the URL string and so I am looking for an alternative way to achieve this from the Kendo Grid.
Any help would be appreciated.
Thanks,
Navin