MVC Grid Custom Command, Refreshing Row

2 posts, 0 answers
  1. Umut
    Umut avatar
    7 posts
    Member since:
    May 2014

    Posted 09 Mar 2015 Link to this post

    I have a custom command and when i clicked it, i want to call an ajax function and if it returns, i want it to be disable. I have more than 1000 rows , and i want to refresh only related row. 

            .Columns(columns =>
                columns.Bound(c => c.JointNo).Width(140);
                columns.Bound(c => c.WlbJointLocation).Width(190);
                columns.Command(command => command.Custom("FitUp").Click("showDetails"));
            .HtmlAttributes(new { style = "height: 380px;" })
            .Pageable(pageable => pageable
            .DataSource(dataSource => dataSource
                    .Read(read => read.Action("Grid_Read", "WlbExplorer"))
        .Title("Customer Details")
    <script type="text/x-kendo-template" id="template">
        <div id="details-container">
            <h2>#= JointNo # #= JointNo #</h2>
            <em>#= WlbJointLocation #</em>
                <dt>City: #= WlbJointLocation #</dt>
                <dt>Address: #= WlbJointLocation #</dt>
    <script type="text/javascript">
        var detailsTemplate = kendo.template($("#template").html());
        function showDetails(e) {
            var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
            var wnd = $("#Details").data("kendoWindow");
  2. Alexander Popov
    Alexander Popov avatar
    1445 posts

    Posted 11 Mar 2015 Link to this post

    Hi Umut,

    You can use the Grid's DataBound event handler to iterate over the items in the current view and check the value of a certain field. If the for example the field's value is true, find the corresponding row by its data-uid attribute and apply the k-state-disabled class to the command button. Then, once the showDetails function is called you can again check the value of the field and decide whether to execute the logic or not. In case the logic is executed and the Ajax request is done you can set the field's value to prevent the user from clicking the same button again.

    Alexander Popov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top