阅读背景:

当尝试使用ASP从Kendo UI网格中的子网格重定向时出错。NET MVC

来源:互联网 
@(Html.Kendo().Grid<ClaimTravelCashSelectByApproverId_Result>()
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(e => e.chkbox)
                .HeaderTemplate("<input type='checkbox' id='chkAllClaim'/>")
                .ClientTemplate("<input type='checkbox' class='clsClaim'/>")
                .HtmlAttributes(new { style = "text-align: center" })
                .Filterable(false)
                .Width(50);
            columns.Bound(e => e.Name)
                .Filterable(filterable => filterable.UI("name"))
                .Width(150)
                .Title("Claim");
            columns.Bound(e => e.Description)
                .Filterable(false)
                    .Width(150);
            columns.Bound(e => e.Amount)
                .Filterable(false)
                    .Width(100);
            columns.Bound(e => e.Status)
                    .Width(100);
            columns.Bound(e => e.FullName)
                    .Width(150);
            columns.Bound(e => e.CreatedDate).ClientTemplate("#= kendo.toString(kendo.parseDate(CreatedDate,'dd/MM/yyyy'), '" + ProjectSession.DateFormat + "') #")
                    .Width(100);
            columns.Template(@<text></text>).ClientTemplate(
        @Html.ViewLink("View Comment", "javascript:", null, null, new { datahref = Url.Action("_ViewClaimComment", "Home", new { Data = "#=ClaimId#" }), @class = "clsView" }).ToHtmlString())
        .Width(50);

        })
        .Sortable()
        .Pageable()
        .Scrollable()
        .ClientDetailTemplateId("template")
        .HtmlAttributes(new { style = "height:1000px;" })
        .Filterable(filterable => filterable
        .Extra(false)
         .Operators(operators => operators
            .ForString(str => str.Clear()
                .StartsWith("Starts with")
                .IsEqualTo("Is equal to")
                .IsNotEqualTo("Is not equal to")
            ))
        )
        .DataSource(dataSource => dataSource
            .Ajax()
            .PageSize(6)
                    .Read(read => read.Action("claimApproverList", "Approver"))
        )
        .Events(events => events.DataBound("dataBound")))

<script id="template" type="text/kendo-tmpl">@(Html.Kendo().Grid<ClaimSelectByApproverIdByClaimId_Result>()
            .Name("grid_#=ClaimId#")
            .Columns(columns =>
            {
                columns.Bound(o => o.ClaimId).Width(110);
                columns.Bound(o => o.ClaimTypeId).Width(110);
                columns.Bound(o => o.ClaimTypeName).Width(110);
                columns.Bound(o => o.NoOfItems).Width(110);
                columns.Template(@<text></text>).ClientTemplate(
                    @Html.ViewLink("View", "RedirectByClaimTypeName", "Approver", new { Data = "#=ClaimId#" , TypId = "#=ClaimTypeId#" }).ToHtmlString())
                    .Width(50);
            })
            .DataSource(dataSource => dataSource
                .Ajax()
                //.PageSize(10)
                .Read(read => read.Action("GetClaimInnerGridByClaimId", "Approver", new { ClaimId = "#=ClaimId#" }))
            )
            //.Pageable()
            //.Sortable()
            .ToClientTemplate()
)</script>

/* View comment fro claim*/
$(".clsView").click(function (e) {
    e.preventDefault();
    e.stopPropagation();
    alert($(this).attr("datahref"));
    $("#divCommentsdialog").load($(this).attr("datahref")).dialog({
        modal: true,
        height: 450,
        width: 600,
        draggable: false,
        resizable: false,
        dialogClass: 'no-close success-dialog',
        title: '@objFieldNameList["Claim"]' + " " + '@objFieldNameList["Comment"]',
        close: function (event, ui) {
            $(this).dialog('destroy');
            $("#divCommentsdialog").empty();
        }
    });
});




$("#chkAllClaim").click(function () {
    $('.clsClaim').prop('checked', $(this).is(':checked'));
});



/* If all checkbox is checked than top checkbox will be checked.*/
$('.clsClaim').click(function () {
    if ($('.clsClaim:not(:checked)').length > 0) {
        $("#chkAllClaim").prop('checked', false);
    }
    else {
        $("#chkAllClaim").prop('checked', true);
    }
});
@(Html.Kendo().Grid<ClaimTravelCashSelectByAppr



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: