Search code examples
htmlasp.net-mvctagsactionlink

mvc actionlink show html tags


how can i show html tags like this

html.actionlinlk("<b>bla bla</b>", null)

it dislay bla bla not bold bla bla-is it possible to show bold text?


Solution

  • I strongly agree with Darin Dimitrov. You should not store html in your db. But you can solve this problem anyway. Ether you use Url.Action and write the <a /> tag your self. Like this:

    <a href="<%=Url.Action("action", "controller")%>">Text</a>
    

    Or you will have to build your own html extension for actionlink as the default one (correctly) html encodes the value you put in.

    I would suggest the first one as I think you should write the html your self instead of using a helper. It's not hard to write a <a /> tag.