// GET: Ajax public ActionResult Index() { Product p1 = new Product { ProductCode = "1", ProdName = "Mobile", ProdQty = 75 }; Product p2 = new Product { ProductCode = "2", ProdName = "Laptop", ProdQty = 125 }; Product p3 = new Product { ProductCode = "3", ProdName = "Netbook", ProdQty = 100 }; prodList.Add(p1); prodList.Add(p2); prodList.Add(p3); return View(); }
public PartialViewResult ShowDetails() { System.Threading.Thread.Sleep(3000); string code = Request.Form["txtCode"]; Product prod = new Product(); foreach (Product p in prodList) { if (p.ProductCode == code) { prod = p; break; } } return PartialView("_ShowDetails", prod); }