public ActionResult CategoriesList() { JeansDbContext db = new JeansDbContext(); string strResponse = "<div id=\"JeansItemsAcc\" style=\"width:200px; margin:0px; padding:0px;\">"; foreach (var Jeanscat in db.JeansCategories.ToList <JeansCategory>()) { strResponse += "<h3 style='width:100%; background-color:red; height:25px; color:white;margin:0px; padding:5px;'>" + Jeanscat.strCategory + "</h3>"; strResponse += "<div style='width:100%; background-color:#ffcc00; height:100%;margin-left:2px; padding:0px 0px 0px 5px;'>"; var JeansItems = db.Jeanses.Where(g => g.JeansCategoryID == Jeanscat.JeansCategoryID).ToList(); foreach (var JeansItem in JeansItems) { strResponse += " <a href=\"/Jeanses/Details/" + JeansItem.ID + "\">" + JeansItem.Jeans_Name + "</a><br>"; } strResponse += "</div>"; } strResponse += "</div>"; ViewBag.strResponse = strResponse; return(PartialView()); }