当绑定到一个中继器电流注入项目的索引 [英] Inject Index of Current item when binding to a repeater

查看:116
本文介绍了当绑定到一个中继器电流注入项目的索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我绑定一个名单,其中,HtmlImage> 来转发

它实际上是一个嵌套的中继器和列表是父中继器结合

Its actually a nested repeater and the list is one of the properties that the parent repeater is binding to

我要吐了当前的DataItem的索引的id属性的<李>

I want to spit out the index of the current dataitem into the id property of the <li>

我已经把一个评论,我想该指数将出现以下

I've put a comment where I want the index to appear below

我有以下几点:

 <asp:Repeater ID="ImageListRepeater" runat="server" DataSource='<%# DataBinder.Eval(Container.DataItem, "Images") %>'>
                            <HeaderTemplate><ul></HeaderTemplate> 
                            <ItemTemplate>
                                <li id='<% **I want the Index Here**  %>'><%# RenderImage(Container.DataItem)%></li>
                            </ItemTemplate>
                            <FooterTemplate></ul></FooterTemplate>
    </asp:Repeater>

有什么选择?

What are the options?

感谢

推荐答案

您是否尝试过&LT;%#Container.ItemIndex%&GT;

这篇关于当绑定到一个中继器电流注入项目的索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆