Friday, 2 September 2016

How to add a razor value and a string in an HTML attribute?

Let's assume a scenario, where we need to provide the unique ids or set the Unique attribute name for HTML controls on the Page using the Razor value on the Page.

To set HTML Control attribute name (string concatenated with razor value), we should set the attribute name as follows:
<div id="@("box"+number)"></div>