I am newbie with this tool to development a new ecommerce site and i have some problem when i try to add ajax code.
When I try to create a new control using a repeater and update panel ajax control to paginate the product list , the explorer show me this error:
"Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.".
Could anyone say me why? or helpme about the ajax code in the nopcommerce tool?
repeater box -> contains the productbox2 control to show products. button btnPost and btnPrev -> is the button that allow the user move between the diferent page tho show product, every page show only 5 products. DropDownList cmbPag-> Allow the user to select any page number.
The code to update the updatepanel in the control "paginar" is this:
and the BindData() code is: ------------------------------------------------------------------------------------------- int pag = 1; if (Session["Pag"] != null) pag = ((int)Session["Pag"]); if (pag <= 1) { btnPrev.Enabled = false; cmbPag.Enabled = false; } if (Session["Products"] != null) { ProductCollection products = (ProductCollection)Session["Products"]; Session.Remove("Products");
int totalItems = products.Count; int maxitemsporpag = SettingManager.GetSettingValueInteger("MaxItemPerPage.ProductBox2"); int cantpags = (int)Math.Round((double)(totalItems / maxitemsporpag), 0) + 1; for (int j = 1; j <= cantpags; j++) { cmbPag.Items.Add(j.ToString()); }
if (pag > 1) cmbPag.SelectedIndex = pag - 1; if (pag < cantpags) btnPost.Enabled = true;
ProductCollection products2 = new ProductCollection(); int i = 1; foreach (Product pr in products) { if (i > ((pag - 1) * maxitemsporpag) && i <= (pag * maxitemsporpag)) products2.Add(pr); i = i + 1; }