Tuesday, 3 September 2013

Razor - referring to current HTML-Element?

Razor - referring to current HTML-Element?

In Razor (MVC 4) can I do something like the following (pseudo)code?
<div id="One" @if(THIS_ID_IS("One")) {WRITE_SOMETHING_HERE} ></div>
<div id="Two" @if(THIS_ID_IS("One")) {WRITE_SOMETHING_HERE} ></div>
My intention is, that in DIV "One" an additional attribute will be
written, but not in DIV "Two"
So, the THIS_ID_IS(string id) should determine, if the Razor-Parse is
INSIDE the given DIV with id="xyz"
Is this possible?

No comments:

Post a Comment