admin管理员组文章数量:1391836
currently i am working in asp mvc5 project on kendo-ui grid...
I want to know if there is possibility of making action link or url.action in grid where grid button lies....
<script>
$(document).ready(function () {
var projectdata = "http://localhost:xxxx",
$("#grid").kendoGrid({
dataSource: dataSource,
pageable: true,
toolbar: ["create"],
scrollable: false,
sortable: true,
groupable: true,
columns: [
{ field: "Name", title: "Task Name", width: "170px" },
{ field: "Status", title: "Status", width: "110px" },
{ field: "IsActive", title: "Active", width: "50px" },
{ mand: ["edit", "delete", "Setting", "Task"], title: " ", width: "150px" }
],
editable: "popup"
});
});
</script>
I have to change "Setting" in Command field and put action link or url.action there.
currently i am working in asp mvc5 project on kendo-ui grid...
I want to know if there is possibility of making action link or url.action in grid where grid button lies....
<script>
$(document).ready(function () {
var projectdata = "http://localhost:xxxx",
$("#grid").kendoGrid({
dataSource: dataSource,
pageable: true,
toolbar: ["create"],
scrollable: false,
sortable: true,
groupable: true,
columns: [
{ field: "Name", title: "Task Name", width: "170px" },
{ field: "Status", title: "Status", width: "110px" },
{ field: "IsActive", title: "Active", width: "50px" },
{ mand: ["edit", "delete", "Setting", "Task"], title: " ", width: "150px" }
],
editable: "popup"
});
});
</script>
I have to change "Setting" in Command field and put action link or url.action there.
Share Improve this question edited Sep 15, 2015 at 14:31 Matt Millican 4,0544 gold badges42 silver badges55 bronze badges asked Jun 5, 2015 at 12:30 S.ZirkS.Zirk 1391 gold badge2 silver badges9 bronze badges 1- can i do this like @Html.ActionLink("Setting", "Home", "ProjectContr", new { orderId = id },null) – S.Zirk Commented Jun 5, 2015 at 12:32
2 Answers
Reset to default 3if you are using asp mvc why not use the razor code?
heres a example, hope it helps
@(Html.Kendo().Grid<YourObject>()
.Name("grid")
.TableHtmlAttributes(new { style = "min-height: 331px;" })
.ToolBar(t => t.Create())
.Columns(columns =>
{
columns.Template(@<text></text>).ClientTemplate("<div style=\"text-align:center\">" +
"<a href=\"" + Url.Action("Test", new { id = "#=Id#"}) + "\"><i style=\"padding-right: 8px;\" title=\"Setting\" class=\"fa fa-pencil fa-lg\"></i></a>" +
"</div>").Width(60).Title("");
columns.Bound(c=>c.Id).Hidden(true);
columns.Bound(c=>c.Name);
columns.Bound(c => c.Status);
columns.Bound(c => c.IsActive).ClientTemplate("<div style=\"text-align:center\">" +
"# if(Active) {#" +
"yes" +
"#} else {#" +
"no" +
"#}#" +
"</div>").Width(15);
})
.Sortable()
.Filterable()
.Pageable()
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(m => m.Id))
.Read(read => read.Action("Read", "YourObject"))
)
).Filterable()
)
Create a custom mand template:
<script id="mand-template" type="text/x-kendo-template">
<a class="k-button k-grid-even" href=" @Html.ActionLink("Setting", "Home", "ProjectContr", new { orderId = id },null)">Even</a>
</script>
and add it as part of your columns
columns: [
{ field: "Name", title: "Task Name", width: "170px" },
{ field: "Status", title: "Status", width: "110px" },
{ field: "IsActive", title: "Active", width: "50px" },
{ mand: ["edit", "delete", "Setting", "Task"], title: " ", width: "150px" },
{ template: kendo.template($("#mand-template").html())}]
Know that this will work only if the code is part of the cshtml file as the like needs to be parsed. The link will fail if its separated to a js file.
本文标签: javascriptHow to make actionlinkurlaction in kendoui gridStack Overflow
版权声明:本文标题:javascript - How to make actionlinkurl.action in kendo-ui grid - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744769413a2624245.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论