Hi, I am trying to customize my mvc grid, here is the image https://ufile.io/6c1xf
1. No header, the columns.bound to customize instead of c.name
2. How to put edit and delete into 1 column?
3. How to call javascipt in string not integer?
@(Html.Kendo().Grid<iOneDistribution.Web.Models.Users.UserViewModel>()
.Name("grid")
.Columns(columns =>
{
//1. header must be able to customize.
//3. it doesn't call the datagrid as this must be in string not integer
columns.Bound(c =>
c.Name).ClientTemplate(
"<a style='cursor:pointer' onclick='getEditView('#=UserCode#');' " +
">EDIT</a>").Width("90");
// 2. it is in the other column, i want to put into 1 column with the edit
columns.Command(command =>
{
command.Destroy().Text(" ");
}).Width(100);
columns.Bound(c => c.Name);
columns.Bound(c => c.Email);
columns.Bound(c => c.MobilePhone);
columns.Bound(c => c.OfficePhone);
columns.Bound(c => c.HomePhone);
columns.Bound(c => c.UserPosition);
columns.Bound(c => c.IsSalesPerson);
columns.Bound(c => c.IsPurchaser);
columns.Bound(c => c.IsActive);
columns.Bound(c => c.IsAllowApprove);
columns.Bound(c => c.DefaultCulture);
})
.Pageable()
.Sortable()
.Filterable()
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Model(model => model.Id(u => u.UserCode))
.Read(read => read.Action("Users_Read", "Users"))
.Destroy(update => update.Action("Destroy", "Users"))
)
)
function getEditView(id) {
alert(id);
$.post("@Url.Action("ShowEdit", "Users")", {id: id}, function(data) {
if (data) {
$('#EditDiv').append(data);
}
});
}
</script>