We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

how to load template for add or edit record in for grid in partial view

I have to do when  for edit and add record in grid  i have to load adding record template in partial view in place of grid view

i. e. in place of grid view i have to load add record template and dont want to show grid and after save click on template i have to load that grid with added new record




2 Replies

GO Gomtesh replied to Gomtesh Hatgine June 5, 2015 11:35 AM UTC

I have to do when  for edit and add record in grid  i have to load adding record template in partial view in place of grid view

i. e. in place of grid view i have to load add record template and dont want to show grid and after save click on template i have to load that grid with added new record




please suggest solution only using AngularJS 


AS Alan Sangeeth S Syncfusion Team June 8, 2015 10:28 AM UTC

Hi Gomtesh,

Thanks for using Syncfusion products.

We are glad to let you know that we have created a sample based on your requirement and the same can be downloaded from below link.

Sample: http://www.syncfusion.com/downloads/support/forum/119327/ze/Simple_JS_sample1398869491

In the above sample we have included Editing template from partial view using “ng-include” angular directive. And then using angular “ng-show” directive and “actionBegin” Grid event we have hidden/shown Grid and Edit template. Please refer the following code snippets.

<div ej-grid id="gridID" e-datasource="data" e-columns="columns" e-actionbegin="editHandler">

            </div>

        </div>

        <div ng-if="leadview">

            <div ng-include="'EditTemplate.html'">

            </div>


        </div>



<script>

$scope.gridpage = true;

$scope.leadview = false;


$scope.editHandler = function (args){

if(args.requestType =="add" || args.requestType =="beginedit"){

var data = $.extend({},this.model.currentViewData[args.rowIndex]);

$scope.editData = data;

$scope.$apply(function(){

$scope.gridpage = false;

$scope.leadview = true;

});

args.cancel = true; // to prevent default action

}

                                      }



Please let us know if you need any further assistance.

Regards,
Alan Sangeeth S

Loader.
Up arrow icon