I have one div
in grid view view i have 2 buttons
edit and button
Add
Edit
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsForums
Top experts
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Faisal PathanRank #291 · 8.6K reputationPosted Dec 17, 2018, 7:04 PM EST
Mahesh ReddyRank #4,018 · 371 reputationPosted Dec 18, 2018, 6:25 PM EST
<html><head><linkhref="//netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"rel="stylesheet"><linkrel="stylesheet"href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css"><linkhref="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.2-rc.1/css/select2.min.css"rel="stylesheet"/><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.min.js">script><scriptsrc="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js">script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.2-rc.1/js/select2.min.js">script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.2-rc.1/js/select2.full.js">script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.5/angular.js">script><scriptsrc="//ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-animate.js">script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.22/pdfmake.min.js">script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.min.js">script><scriptsrc="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-1.3.3.js">script><linkhref="//netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"rel="stylesheet"><scriptsrc="~/scripts/invoice.js">script><scriptsrc="~/scripts/dirpagination.js">script><script>var app = angular.module('invoice', ['angularUtils.directives.dirPagination', 'ngAnimate', 'ui.bootstrap']);$scope.invoice = false;//categoryGetCategory();function GetCategory() {$scope.categories = [];$http({method: 'Get',url: '/invoice/GetCategories/',}).success(function (data, status, headers, config) {$scope.categories = data;}).error(function (data, status, headers, config) {$scope.message = 'Unexpected Error';});}GetProduct();function GetProduct() {$scope.products = [];$http({method: 'Get',url: '/invoice/GetProducts/',}).success(function (data, status, headers, config) {$scope.products = data;}).error(function (data, status, headers, config) {$scope.message = 'Unexpected Error';});}$scope.ShowHide = function () {//If DIV is visible it will be hidden and vice versa.$scope.invoice = $scope.invoice ? false : true;}$scope.IsVisible = true;GetAllEmployees();//To Get All Recordsfunction GetAllEmployees() {debugger;var getData = RegistrationService.getEmployees();getData.then(function (emp) {$scope.employees = emp.data;}, function (emp) {alert("Records gathering failed!");});}$scope.myData = [];// Add functionality for Items$scope.add = function () {debugger;loadEmployees();$scope.myData.push({id: $scope.myData.length + 1,Product: $scope.Product.ProductName,ProductId: $scope.Product.ProductID,Name: $scope.Name,});};//Edit code for Items and Orders$scope.Edit = function (OrderId) {debugger;$scope.invoice = true;var id = OrderId;//var id = $scope.employees[index].OrderId;$.post("/invoice/Edit/", { orderID: id }, function (r) {debugger;$scope.OrderId = r.Orders.OrderId;$scope.OrderName = r.Orders.OrderName;$scope.Category = r.Orders.CategoryID;$scope.myData = [];for (var i = 0; i <r.Items.length; i++) {var customer = {};customer.OrderId= r.Items[i].Name;customer.OrderName= r.Items[i].Name;customer.Category= r.Items[i].Name;customer.Id= r.Items[i].Id;customer.Product= r.Items[i].ProductID;customer.Name= r.Items[i].Name;$scope.myData.push(customer);}});}}]);app.service("RegistrationService", function ($http) {//get All Employeethis.getEmployees=function() {return $http.get("/invoice/getAll");};});head><body><divclass="container"ng-app="invoice"ng-controller="InvoiceController"><divclass="row"><tableclass="table table-condensed"><tr><td>Order Nametd><td><inputtype="text"id="orderName"class="form-control"name="name"ng-model="OrderName"ng-class="submitted?'ng-dirty':''"required autofocus />td><td>Categorytd><td><selectclass="input-sm form-control"name="CategortName"ng-model="Category"containerCssClass="all"ng-options="c as c.CategortName for c in categories"ng-disabled="disabled"><optionvalue="">Select Categoryoption>select>td>tr>table>div><divclass="s2vk-container"><divclass="row"><tableclass="table table-condensed"><thead><tr><th>SNoth><th>Productth><th>Nameth>tr>thead><tbodystyle="padding-left:20px; padding-right:20px;"ng-model="myData1"ng-repeat="invoice in myData track by $index"><tr><td>{{invoice.id}}td><td>{{invoice.Product}}td><td>{{invoice.Name}}td>tr>tbody><tfoot><trstyle="padding-left:20px; padding-right:20px;"ng-show="mahesh"><tdng-model="Id">{{$index+1}}td><td><inputtype="text"ng-model="Name"class="input-sm form-control"/>td><td><selectng-model="Product"name="ProductName"class="input-sm form-control"ng-options="s as s.ProductName for s in products"><optionvalue="">-- Select Product --option>select>< /td><td><buttontype="button"ng-show="mahesh"class="btn btn-success btn-sm"ng-click="add()">button>td>tr>tfoot>table>div>div><divclass="table-responsive "><tableid="dvData"cellpadding="12"class="table table-bordered table-hover table-striped"><tr><th>Order Idth><th><b>Order Nameb> <spanclass="glyphicon sort-icon"ng-show="sortKey=='OrderName'"ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"re>span>th><th><b>Categoryb> <spanclass="glyphicon sort-icon"ng-show="sortKey=='Category'"ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}">span>th><th><b>Actionsb> <spanclass="glyphicon sort-icon">span>th>tr><trdir-paginate="employee in employees|orderBy:sortKey:reverse|filter:search|itemsPerPage:10"ng-model="search"><td>{{employee.OrderId}}td><td>{{employee.OrderName}}td><td>{{employee.Category}}td><td><buttontype="button"class="btn btn-info btn-sm"ng-click="Edit(employee.OrderId)"readonly>Editbutton>td>tr>table><dir-pagination-controlsmax-size="10"direction-links="true"boundary-links="true">dir-pagination-controls>div>div>body>html>