Boris Callens
Boris Callens

Reputation: 93327

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.

Upvotes: 1

Views: 372

Answers (2)

ten5peed
ten5peed

Reputation: 15890

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

Upvotes: 1

Gideon
Gideon

Reputation: 18491

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.

Upvotes: 1

Related Questions