Here is my View that contains the KendoUI Grid Control: I want to add a new column that contains a hyperlink before the Date of creation column .
@using Kendo.Mvc.UI
@model IEnumerable<ExamplekendoDropdown.Models.FacilityGroup>
@{
ViewBag.Title = "Grid";
}
<table width="700">
<tr>
<td align="center">
<table width="1000">
<tr>
<td align="left">
@using (Html.BeginForm("Grid", "Grid", FormMethod.Get))
{
<table>
<tr>
<td>
<span>Facility Group Name</span>
</td>
<td>
@(Html.Kendo().AutoComplete()
.Name("FacilityGroupName")
.Value("")
.Enable(true)
)
@Html.Hidden("FacilityGroupName")
</td>
</tr>
<tr>
<td>
<input id="Submit1" type="submit" value="Search" />
</td>
</tr>
</table>
}
</td>
</tr>
<tr>
<td align="center" >
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.FacilityGroupId);
//columns.Bound(@Html.ActionLink("Create Facility", "Facility"));
columns.Bound(p =>p.FaclityGroupName);
columns.Bound(p => p.status).Width(80);
columns.Bound(p => p.CreationDate);
columns.Command(command => { command.Edit(); });
})
//.ToolBar(toolbar =>toolbar.Create())
//.Editable(editable => editable.Mode(GridEditMode.PopUp))
.Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("EditUserPopupTemplate")
.Window(w => w.Title("Facility").Name("editWindow").Width(300).Height(300)))
.Pageable()
.Sortable()
.Scrollable()
.DataSource(datasource => datasource
.Server()
.Model(model => model.Id(p => p.FacilityGroupId ))
.Read("Grid", "Grid")
.Update("Update", "Grid")
//.Create("Create","Grid")
//.Destroy("Destroy","Grid")
)
)
<script type="text/javascript">
$(document).ready(function () {
$("form.k-edit-form").kendoValidator();
});
</script>
</td>
</tr>
</table>
</td>
</tr>
</table>
Now i need to add another column before the "Date Of Creation" Column that contains a hyperlink. Please share your inputs Thanks
But why not this if you are using ajax
Ajax().ClientTemplate("<a href='" + Url.Action("YourAction", "YourController") +"/#= Id #'" +">#=FileName#</a>");
if server()
columns.Bound(p => p.ProductID).Template(@<text>
@Html.ActionLink("Show Product Details", "ProductDetails", new { id = @item.ProductID } )>
</text>);
This example
columns.Template(@<text></text>).ClientTemplate(
@Html.ActionLink("Send Reset Email", "Login", new { loginButton = "reset",activate=true,fromAdmin=true,rowField="#=rowField#" }).ToHtmlString()
);
This worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With