views:

89

answers:

2
+1  Q: 

Create custom tag

In my views I verry often have to write

<%=Model.T9n.TranslateById("someId");%>

Is there some way to make this more compact/readable. A custom tag maybe?

<asp:T9n>someId</asp:T9n>

or better

<t9n: someId />

Note
There are several (business) reasons why I can't use the default T9n tools in visual studio so that's why I've rolled my own.

+1  A: 

Yes you can create a custom control and get something like <prefix:t9n translationID="someID" runat="server"/>

Just Google for web custom control and you'll get tons of hits.

Gidon
Thx .
borisCallens
hmm, the syntax seems too verbose in comparisson with an HtmlHelper.
borisCallens
+1  A: 

I don't know anything about creating custom tags in MVC...

You could create your own custom HtmlHelper extension method. E.g.

<%=Html.T9n("someId");%>

HTHs, Charles

Charlino
Thought about it, but not quiet what I want.
borisCallens
But in second thought it seems to best solution available.
borisCallens