public ActionResult ComplainType() { List <ComplainType> CategoryList = new List <ComplainType>(); Property p = new Property(); DataSet ds = new DataSet(); p.OnTable = "FetchComplainType"; ds = dl.FetchComplainType_sp(p); try { foreach (DataRow item in ds.Tables[0].Rows) { ComplainType m = new ComplainType(); m.CId = item["CId"].ToString(); m.CType = item["CType"].ToString(); m.AddedBy = item["AddedBy"].ToString(); m.Description = item["Description"].ToString(); m.IsActive = item["IsActive"].ToString(); CategoryList.Add(m); } ViewBag.CategoryList = CategoryList; } catch (Exception e) { } return(View()); }