I cant seem to get the URL's in a simple list which I can show on a page. I already have the connection with the database in another project within my solution and that works for sure. only problem is putting the data into a list.
URLController
public class URLController : Controller
{
public ActionResult List()
{
LinkHubDbEntities db = new LinkHubDbEntities();
ViewBag.UrlList = new SelectList(db.tbl_Url.OrderBy(c => c.UrlId), "UrlTitle", "UrlDesc");
return View();
}
}
The view :
@model BOL.tbl_Url
@{
ViewBag.Title = "List";
}
<ul>
@foreach (var UrlId in ViewBag.UrlList)
{
<li>@tbl_Url.UrlTitle</li>
}
</ul>