Thursday, 23 July 2015

pass tabular data at client side / array

Server Side:
        var publicationTable = new List{};
       // reportpricingservice.GetAll().ForEach(a=> publicationTable.Add(new object[]{a.ReportTypeId,a.TestTypeId,a.Price}));
        reportpricingservice.GetAll().ForEach(a => publicationTable.Add(new {a.ReportTypeId, a.TestTypeId, a.Price }));
        return (new JavaScriptSerializer()).Serialize(publicationTable);

Client side:
var reportpricings = <%= getReportPricing() %>;

 function getprice(TestType,ReportType)
        {
            return $.grep(reportpricings, function (reportpricing)
            {
                return (reportpricing.ReportTypeId == ReportType && reportpricing.TestTypeId == TestType);
            })[0].Price;
        }


Avast logo
This email has been checked for viruses by Avast antivirus software.
www.avast.com

No comments:

Post a Comment