In my MVC 4 application I'm using Kendo UI Grid. For data binding I'm using Ajax
Code in view look like this:
Html.Kendo().Grid(new DataTable())
.Name("grid-zaznamy")
.Columns(columns =>
{
columns.Bound("Code").Title("Kod").Width(30).HeaderHtmlAttributes(new {title = "Kod klienta"}).ClientTemplate("# if (Code === 'A') { # <img title='Our client' src='" + @Url.Content("~/Content/Images/ico_16x16_our.png") + "' # } #");
columns.Bound("Name").Title("Jmeno").Width(55).HeaderHtmlAttributes(new {title = "Jmeno klienta"});
columns.Bound("Surname").Title("Prijmeni").Width(60).HeaderHtmlAttributes(new {title = "Prijmeni klienta"});
columns.Template(@<text></text>).ClientTemplate("<div class='actions'><a id='link_client_#=ClientId#' href='" + Url.Action("Prehled", "Klient") + "/#=ClientId#?nadorId=#'>Detail</a></div>").Width(150);
})
.DataSource(dataBinding => dataBinding
.Ajax()
.ServerOperation(true)
.Total(Model.TotalCount)
.PageSize(20)
.Read("DataGrid", "Zaznamy", Model.Filter)
.Model(model => model.Id("Id")))
.Pageable(paging =>
paging.PageSizes(new[] {20, 50, 100, 200, 500, 1000}))
.Scrollable(c => c.Height("600px"))
.Resizable(resizing => resizing.Columns(true))
.Events(events => events.DataBound("onDataBound"))
.Sortable()
.Render();
Action in Controler look like this:
[AjaxRequest]
public ActionResult DataGrid(GridCommand command)
{
.
.
model.Data = load ...
return Json(new DataSourceResult {Data = model.Data, Total = model.TotalCount}, JsonRequestBehavior.AllowGet);
}
The broblem is when I click on column header, binding action is called, but then I'm redirected to that action bz get.
That's why in header is generated:
<a class="k-link" href="/Zaznamy/DataGrid?IsEmpty=False&RodneCislo=60&UseLast=False&Filter.RodneCislo=60&_submit=None&grid-zaznamy-sort=KrajOkres-asc">
I dont know how to suppress that contet of href. In all samples which I have ever seen was #
Code in view look like this:
Html.Kendo().Grid(new DataTable())
.Name("grid-zaznamy")
.Columns(columns =>
{
columns.Bound("Code").Title("Kod").Width(30).HeaderHtmlAttributes(new {title = "Kod klienta"}).ClientTemplate("# if (Code === 'A') { # <img title='Our client' src='" + @Url.Content("~/Content/Images/ico_16x16_our.png") + "' # } #");
columns.Bound("Name").Title("Jmeno").Width(55).HeaderHtmlAttributes(new {title = "Jmeno klienta"});
columns.Bound("Surname").Title("Prijmeni").Width(60).HeaderHtmlAttributes(new {title = "Prijmeni klienta"});
columns.Template(@<text></text>).ClientTemplate("<div class='actions'><a id='link_client_#=ClientId#' href='" + Url.Action("Prehled", "Klient") + "/#=ClientId#?nadorId=#'>Detail</a></div>").Width(150);
})
.DataSource(dataBinding => dataBinding
.Ajax()
.ServerOperation(true)
.Total(Model.TotalCount)
.PageSize(20)
.Read("DataGrid", "Zaznamy", Model.Filter)
.Model(model => model.Id("Id")))
.Pageable(paging =>
paging.PageSizes(new[] {20, 50, 100, 200, 500, 1000}))
.Scrollable(c => c.Height("600px"))
.Resizable(resizing => resizing.Columns(true))
.Events(events => events.DataBound("onDataBound"))
.Sortable()
.Render();
Action in Controler look like this:
[AjaxRequest]
public ActionResult DataGrid(GridCommand command)
{
.
.
model.Data = load ...
return Json(new DataSourceResult {Data = model.Data, Total = model.TotalCount}, JsonRequestBehavior.AllowGet);
}
The broblem is when I click on column header, binding action is called, but then I'm redirected to that action bz get.
That's why in header is generated:
<a class="k-link" href="/Zaznamy/DataGrid?IsEmpty=False&RodneCislo=60&UseLast=False&Filter.RodneCislo=60&_submit=None&grid-zaznamy-sort=KrajOkres-asc">
I dont know how to suppress that contet of href. In all samples which I have ever seen was #