在转发器中设置活动图像 VB.net

Set active image in repeater VB.net

您好!

事不宜迟,我该如何将图像设置为活动状态,因为我在其中收到警告:

Gallery.aspx

<div id="myCarousel" class="carousel slide" data-ride="carousel">
    <div class="carousel-inner" role="listbox">
    <asp:Repeater ID="Rgallary" runat="server">
    <ItemTemplate>


         <div class="item <%#(Container.ItemIndex == 0 ? "active" : "") %> "> //Expression expected.
            <asp:Image ID="imgId" runat="server" ImageUrl='<%# Bind("GalleryImg", "Image/05 Galeri/{0}") %>' /> 
        </div>

    </div>

    </ItemTemplate>
    </asp:Repeater>

    <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
        <span class="glyphicon glyphicon-chevron-left"></span>
        <span class="sr-only">Previous</span>
    </a>
    <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
        <span class="glyphicon glyphicon-chevron-right"></span>
        <span class="sr-only">Next</span>
    </a>

    </div>

虽然很简单,但我想不通怎么办?

虽然你说你的程序是 VB.Net,但你似乎在写 C#?

这是您使用的 C# 代码:

Container.ItemIndex == 0 ? "active" : ""

改用VB.Net:

<div class="item <%#If(Container.ItemIndex = 0, "active", "") %>">