Hi I tried to pass a list of self-defined objects to JQuery as parameter and expect jQuery recognise it as the specific object and loop through it. The class is:
public class PriceSummary{
public string ItemName { get; set; }
public string ItemPrice { get; set; } }
The backend method is:
public void updatePriceSummary(List<PriceSummary> PriceSummaryList){
ScriptManager.RegisterStartupScript(Page, GetType(), "changePriceList",
"updatePriceList('" + PriceSummaryList + "');", true);}
JQuery Method
function updatePriceList(PriceSummaryList) {
PriceSummaryList.each(function ()
{$('#ControlSummaryTitle').append('<tr id = "xxx"> <td class="SummaryItem">' +
this['ItemName'] + '</td> <td class="SummaryPrice">' + this['ItemPrice'] +
'</td></tr>'); })
;}
However, the JQuery function couldn't recognise the parameter as a list and couldn't loop through it. The error message is:
0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'each'
Could anybody advise how to fix it?