public JsonResult GetProductCategory(Product oProduct) { List <ProductCategory> oProductCategorys = new List <ProductCategory>(); ProductCategoryService oProductCategoryService = new ProductCategoryService(); try { if (oProduct.ProductTypeID > 0) { oProductCategorys = oProductCategoryService.GetsByProductType((int)oProduct.ProductTypeID, (int)Session[GlobalSession.UserID]); } } catch (Exception ex) { ProductCategory oProductCategory = new ProductCategory(); oProductCategory.ErrorMessage = ex.Message; oProductCategorys.Add(oProductCategory); } JavaScriptSerializer serializer = new JavaScriptSerializer(); string sjson = serializer.Serialize(oProductCategorys); return(Json(sjson, JsonRequestBehavior.AllowGet)); }