Asp.net 在repeater VB.net中设置活动映像

Asp.net 在repeater VB.net中设置活动映像,asp.net,vb.net,asprepeater,Asp.net,Vb.net,Asprepeater,问候 如果没有进一步的操作,我如何将图像设置为活动,因为我在其中得到警告: Gallery.aspx <div id="myCarousel" class="carousel slide" data-ride="carousel"> <div class="carousel-inner" role="listbox"> <asp:Repeater ID="Rgallary" runat="server"> <ItemTemplat

问候

如果没有进一步的操作,我如何将图像设置为活动,因为我在其中得到警告:

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", "") %>">