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...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
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...