Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
I'm looking for the razor alternative for the Xpath operator "mod".
In XSLT I use it like this:
<xsl:if test="position() mod $groupNumber = 1"><xsl:attribute name="class">firstInRow</xsl:attribute></xsl:if>
How can that be done in Razor? Thanks in advance...
Hi,
the razor alternative for the Xpath operator "mod" is "%"
Example:int pos=0;foreach(var item in @Model.Children.Where("Visible")){ pos++; if(pos % groupNumber == 1) { //your code here... }}
Yes! Great! Thanks
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Razor alternative for Xpath operator "mod"
Hi
I'm looking for the razor alternative for the Xpath operator "mod".
In XSLT I use it like this:
How can that be done in Razor? Thanks in advance...
Hi,
the razor alternative for the Xpath operator "mod" is "%"
Example:
int pos=0;
foreach(var item in @Model.Children.Where("Visible"))
{
pos++;
if(pos % groupNumber == 1)
{
//your code here...
}
}
Yes! Great! Thanks
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.