Skip to content

How to get dropdown selected id data in table grid in Angula

suman goud

Asked Sep 23, 2016, 2:20 AM EDT3 answers
Share
LinkedInX
Customer
Pendings
Pending Value
select Customer
JS
Bash
$scope.rvm = [{}];
    $scope.GetAccountBalance = function (index, c) {


    //adding new row on dropdown change
        if ($scope.rvm.length == (index + 1)) {
            $scope.rvm.push({
            });
        }

        var getPendingData = ReceiptsService.GetPendings(c);
        getPendingData.then(function (d) {


            //var x;
            //for (x in d.data)
            //{
            //    alert('in');
            //    $scope.ReceiptsViewModel = d.data;

            //}

            alert($scope.rvm.length);
            $scope.ReceiptsViewModel = d.data;
            $scope.ReceiptsViewModel.PendingAmount = $scope.ReceiptsViewModel.Amount - $scope.ReceiptsViewModel.AmountAdjusted;

        }, function (error) {
            alert('Error');
        });


    }
controller
C#
public JsonResult GetPendings(int? pendingID)
        {
            string eid = pendingID.ToString();
            TestDemoEntities db = new TestDemoEntities();
            var data = (from ap in db.Accounting_PendingBills
                        join apa in db.Accounting_PendingBillsAdjusted on ap.BillRef equals apa.TowardsBillRef
                        group apa by new { ap.BillDate, ap.Amount, ap.Party, apa.TowardsBillRef } into g
                        select new
                        {
                            BillDate = g.Key.BillDate,
                            Party = g.Key.Party,
                            Amount = g.Key.Amount,
                            BillNumber = g.Key.TowardsBillRef,
                            AmountAdjusted = g.Sum(aa => aa.AmountAdjusted)
                        }).Where(ap => ap.Party == eid).FirstOrDefault();

            return Json(data, JsonRequestBehavior.AllowGet);
        }
by using follwing table am adding new row on dropdown change,and getting selected id data from database ,and binding that to table,
my problem is same data is binding to that added new row also(except dropdown:it is showing select customer ).again if i select another
customer from database getting data correctly,but the data is binding to all.
how to fix this issue, i have tried by giving loop

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Delpin Susai Raj
    0
    Visit this link... In this link have your question answer. http://www.aspsnippets.com/Articles/AngularJS-Get-selected-Text-and-Value-of-HTML-Select-DropDownList-using-ng-change.aspx
    0
  • 0
    hi Delpin,
    am not seeing any post here
    0
  • 1 short reply
    • Delpin Susai Raj
      0
      0