c# - Dynamic menu through use of repeater -




i using repeater create menu (bootstrap styled). need make first item active , can't figure out how. have:

<!-- nav tabs --> <ul id="teamtab" class="nav nav-pills pill-marg" role="tablist">     <asp:repeater runat="server" id="rptmenu">         <itemtemplate>             <li role="presentation">                 <a class="circular" href='#<%# databinder.eval(container.dataitem, "groupabbrev") %>' aria-controls="home"                         role="tab" data-toggle="tab"><%# string.format("{0}", eval("groupname").tostring().toupper()) %></a>             </li>         </itemtemplate>     </asp:repeater> </ul> 

to make first menu item active, style has "active", like:

<li role="presentation" class="active"><a class="circular" ...> 

i think can add <%# container.itemindex == 0 ? "active circular" : "circular" %> inside repeater template (however been years since have used webforms.

example:

<!-- nav tabs --> <ul id="teamtab" class="nav nav-pills pill-marg" role="tablist">     <asp:repeater runat="server" id="rptmenu">         <itemtemplate>             <li role="presentation" class="<%# container.itemindex == 0 ? "active" : "" %>">                 <a class="circular" href='#<%# databinder.eval(container.dataitem, "groupabbrev") %>' aria-controls="home"                         role="tab" data-toggle="tab"><%# string.format("{0}", eval("groupname").tostring().toupper()) %></a>             </li>         </itemtemplate>     </asp:repeater> </ul> 

syntax issues aside (if have any), know index available via itemindex, see docs here.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -