如何获得ASP转发器控件中的迭代次数? [英] How to get the number of iteration in ASP repeater control?
本文介绍了如何获得ASP转发器控件中的迭代次数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只想知道如何在asp.net转发器控件中获取迭代次数。然后我检索它后,我想传递我的javascript变量中的值。
这是aspx:
我尝试过:
I just want to know how to get the number of iterations in an asp.net repeater control. And then after i retrieve it, i want to pass the value in my javascript variable.
Here is the aspx:
What I have tried:
<asp:Repeater ID="Repeater3" runat="server"
OnItemDataBound="subImages_ItemDataBound" ItemType="thumbnailImage"
SelectMethod="GetThumbnail">
<ItemTemplate>
<asp:Image ID="subImage" runat="server" ImageUrl='<%# Item.subimages
%>' CssClass="subPicStyle"/>
</ItemTemplate>
</asp:Repeater>
基本上在我的javascript代码中,我只想将它存储在var numIterations =?
And basically in my javascript code, i just want to store it in var numIterations = ?
推荐答案
首先获取转发器的父元素。设置每个ItemTemplate的ID。然后转发器将一些项目模板作为子元素。
var _Parent =
First get the parent element of repeater. set the id for each ItemTemplate .Then repeater have some item template as child element.
var _Parent =
('#Repeater_id');
int rowsCount = _Parent.children('#itemtemplateID')。length;
('#Repeater_id');
int rowsCount=_Parent.children('#itemtemplateID').length;
这篇关于如何获得ASP转发器控件中的迭代次数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文