public static string GetTelevisions(int id)
 {
     NeweggAPI api = new NeweggAPI();
     List<SubCategory> televisions = api.GetCategoryByName("Electronics").GetSubCategoryByName("Televisions").GetSubCategories();
     string json = "{}";
     if (id < televisions.Count)
     {
         ProductQuery products = televisions[id].QueryProducts();
         List<TelevisionProduct> televisionProducts = new List<TelevisionProduct>();
         foreach (ProductListItem p in products.ProductListItems)
         {
             TelevisionProduct tp = new TelevisionProduct();
             tp.Title = p.Title;
             tp.AverageRating = p.AverageRating.ToString();
             tp.Discount = p.Discount != null ? p.Discount.ToString() : "";
             tp.OriginalPrice = p.OriginalPrice;
             tp.FinalPrice = p.FinalPrice;
             tp.Thumbnail = "<img src='" + p.Image.ThumbnailImagePath + "' />";
             televisionProducts.Add(tp);
         }
         json = new JavaScriptSerializer().Serialize(televisionProducts);
     }
     return json;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            List<HtmlAnchor> navs = new List<HtmlAnchor>();
            navs.Add((HtmlAnchor)Master.FindControl("navHTPC"));
            navs.Add((HtmlAnchor)Master.FindControl("navMediaPlayer"));
            navs.Add((HtmlAnchor)Master.FindControl("navAudio"));
            navs.Add((HtmlAnchor)Master.FindControl("navControl"));
            navs.Add((HtmlAnchor)Master.FindControl("navForum"));
            navs.Add((HtmlAnchor)Master.FindControl("navWishList"));
            foreach (HtmlAnchor nav in navs)
            {
                nav.Attributes["class"] += " navbutton-off";
            }

            NeweggAPI api = new NeweggAPI();
            List<SubCategory> televisions = api.GetCategoryByName("Electronics").GetSubCategoryByName("Televisions").GetSubCategories();

            HtmlGenericControl ul = new HtmlGenericControl("ul");
            ul.Attributes.Add("style", "list-style-type:none;");
            for (int i = 0; i < televisions.Count; ++i)
            {
                HtmlGenericControl li = new HtmlGenericControl("li");
                li.Attributes.Add("onClick", "PageMethods.GetTelevisions(this.id, onGetTelevisions);");
                li.Attributes.Add("id", i.ToString());
                li.InnerHtml = televisions[i].Description;
                ul.Controls.Add(li);
            }
            Master.FindControl("submenu").Controls.Add(ul);
        }