Friday, 31 July 2015

Reload a Telerik Grid in MVC (Kendo MVC)

you can write down this code any function of that grid 

 var grid = jQuery("#Grid").data("kendoGrid");

                grid.dataSource.read();


example:

<script type="text/javascript">
    function onRequestEnd(e) {
              if (e.type === "update") {
         
            var grid = jQuery("#Grid").data("kendoGrid");
            grid.dataSource.read();
        }
        if (e.type === "create") {
                      var value = e.response.Errors;
            if (e.response.Errors) {

            } else {
           
                var grid = jQuery("#Grid").data("kendoGrid");
                grid.dataSource.read();
            }

        }
        if (e.type === "destroy") {
       
            if (e.response.Errors) {
                var grid = jQuery("#Grid").data("kendoGrid");
                // cancel changes
                grid.cancelChanges();
            } else {
                e.sender.read();
            }
        }

    }
   
</script>

No comments:

Post a Comment