I am trying to store HTML and hyperlinks in my SQL server 2008 database. I want to also be able to display the hyperlinks and render the HTML accordingly. I am trying to do this in ASP.NET MVC, so I tried using the HTTPUtility.HtmlEncode() method, but didn't really store it the way I wanted. So can anyone please guide me through the steps I need to take to achieve this.
1 Answer
I think the best approach would be the MVC way in that you have a PartialView for each link. Then all you need to do is itterate through your collection of links and render a Partial View accordingly.
edit
When i say collection of links, i mean a collection of non html links. Just the addresses.
In your controller you might have;
List<string> links = fillList();
Return View(links);
Then in your view;
foreach(string item in Model.links)
Html.Renderpartial("htmlLink", item);