Click here to Skip to main content
14,983,344 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
@(Html.Kendo().Grid<LicenseViewModel>().HtmlAttributes(new { @class = "KGrid" })
    .Name("LicenseGrid")
    .Columns(columns =>
    {
        columns.Bound(p => p.LicenseId).Width("15%");
        columns.Bound(p => p.ContractorId).ClientTemplate("#= ContractorName #").Width("20%");
        columns.ForeignKey(p => p.DischargeLocationId, (System.Collections.IEnumerable)ViewData["DischargeLocationId_Data"], "DischargeLocationId", "Title").Width("20%");
        columns.ForeignKey(p => p.WasteTypeId, (System.Collections.IEnumerable)ViewData["WasteTypeId_Data"], "WasteTypeId", "Title").Width("20%").Visible(false);
        columns.ForeignKey(p => p.AreaId, (System.Collections.IEnumerable)ViewData["AreaId_Data"], "AreaId", "Title").Width("10%").Visible(false).HtmlAttributes(new { min = "1" });
        columns.ForeignKey(p => p.DayOrNight, (System.Collections.IEnumerable)ViewData["DayOrNight_Data"], "Id", "Title").Width("10%").Visible(false);
        columns.Bound(p => p.FromDate).ClientTemplate("#= FromDateP #").ClientGroupHeaderTemplate("#= persianDate(value) #").HtmlAttributes(new { style = "text-align:center" }).Width("10%").Filterable(false);
        columns.Bound(p => p.ToDate).ClientTemplate("#= ToDateP #").ClientGroupHeaderTemplate("#= persianDate(value) #").HtmlAttributes(new { style = "text-align:center" }).Width("10%").Filterable(false);
        columns.Command(command =>
        {
   
            if (User.IsEdit(PageEnum.License)) command.Edit().Text(" ").UpdateText("ثبت").CancelText("انصراف");
            if (User.IsDelete(PageEnum.License)) command.Destroy().Text(" ");
        }).Width("40%").Title("ویرایش").HtmlAttributes(new { style = "text-align:center" }).HeaderHtmlAttributes(new { style = "text-align:center" });
    })
    .ToolBar(toolbar =>
    {
        if (User.IsCreate(PageEnum.License)) toolbar.Create().Text("جدید");
       
    })
Posted

1 solution

Refer - Getting selected row’s data from Kendo Grid
JavaScript
//Selecting Grid
var gview = $("#grid").data("kendoGrid");
//Getting selected item
var selectedItem = gview.dataItem(gview.select());
//accessing selected rows data
alert(selectedItem.email);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900