[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 513
  • Last Modified:

Translation of C# to VB in HTML

I'm working on implementing the following:
http://mosesofegypt.net/page/Building-on-demand-MasterDetail-grouping-Grid-with-GridView-and-ASPNET-AJAX-toolkit-CollapsiblePanelExtender.aspx
After a few stops and starts I am finally getting somewhere converting this to VB and to my particular scenario.
However, I can't seem to get past the following code snippet in the section marked "The Details":

 <ItemTemplate>
         <tr class='<%# (Container.ItemIndex%2==0) ? "row" : "altrow" %>'>
             <td class="rownum">
                <%# Container.ItemIndex+1 %>
             </td>

Can someone please translate this for me correctly?
I've tried the following:

<ItemTemplate>
        <tr class='<%# If ((Container.ItemIndex Mod 2)) = 0  THEN "row"  ELSE "altrow" %>'>
            <td class="rownum"><%#(Container.ItemIndex + 1)%></td>

but I continue to get the error message:
First operand in a binary 'If' expression must be nullable or a reference type.
I know it's got to be something simple I missing in converting things, but I've been staring at this since before the holiday break and, now that we're back, I'm going braindead.

oh, and I did download his project and verified that, yes, his code works as explained. So there's definitely something "Lost in Translation".

Thanks in advance!
0
bmickey
Asked:
bmickey
  • 2
  • 2
1 Solution
 
Luis PérezSoftware Architect in .NetCommented:
<%# Iif((Container.ItemIndex Mod 2 = 0), "row", "altrow") %>
0
 
bmickeyAuthor Commented:
Thanks!
I believe you meant 'if' and not 'lif'?
That works though!
Ugh! Can't believe it was that simple!
0
 
Luis PérezSoftware Architect in .NetCommented:
In fact, it's the "IIF" vb function, not IF operand. Glad to help you.
0
 
bmickeyAuthor Commented:
oh -- Okay.
Thanks!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now