Below is my Model class public class CPUDetail { public int CPUDetailId { get; set; } [Required] [Display(Name = "Quantity")] public int Qty { get; set; } public DateTime CreatedDate { get; set; } public int CreatedBy { get; set; } public DateTime ChangedDate { get; set; } public int ChangedBy { get; set; } [Required] [Display(Name = "CPU Master")] public int CPUMasterId { get; set; } public virtual CPUMaster CPUMaster { get; set; } [Required] [Display(Name = "SubCategory")] public int SubCategoryId { get; set; } public virtual SubCategory SubCategory { get; set; } [NotMapped] public string SubCategoryNme { get; set; } } for retrive data code in controller public JsonResult GetDetail(int CPUMasterId) { string str = ""; CPUDetail cpu = new CPUDetail(); try { _list = CPUDetailRepository.GetCPUDetailByCPUMasterId(CPUMasterId).ToList(); CPUMasterId = 0; str = "Success"; } catch (Exception) { str = "Success"; } return Json(_list, JsonRequestBehavior.AllowGet); } plz have look in this code...
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)