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?
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?
I think your looking for:
<b><%= Html.ActionLink("bla bla", null) %></b>
Update
Ah ok I see what you are looking for. Well the first parameter of the ActionLink extension method is the link text (of the anchor element). As far as I am aware it should support HTML tags.
e.g.
<a href="http://stackoverflow.com">stack<b>overflow</b></a>
gives you stackoverflow
Databases are for storing data. HTML is markup. Don't store HTML inside a database. As you've mixed data and markup you will now need to extract the data (bla bla
) from the markup and formatting (<b>
). There are tools allowing you to parse HTML such as HTML Agility Pack. You could always try parsing it with a regular expression but as you may see this is not recommended.
So my suggestion is to modify your design and separate markup from real data.
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.