在子级中继器控件中绑定父级中继器项索引 [英] Bind parent repeater item index in child repeater control

查看:80
本文介绍了在子级中继器控件中绑定父级中继器项索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友.

我想使用内联代码而不是背后的代码在子级中继器控件中绑定父级中继器项索引.

例如:

Hello friends.

I want to bind parent repeater item index in child repeater control using inline code not code behind side.

For example:

<asp:repeater id="parentRep" runat="Server">
   <ItemTemplate>
      <asp:repeater id="parentRep" runat="Server">
         <ItemTemplate>
                  /* Here I want to bind Parent RepeaterItemIndex */
         </ItemTemplate>
      </asp:repeatere>
   </ItemTemplate>
</asp:repeater>


问候
Imrankhan


Regard
Imrankhan

推荐答案


您可以按照以下代码使用
获取子控件上的父行索引
<% int parentRowIndex = Container.DataItemIndex; %>

Hi
You can you following code to get Parent Row Index on Child Control using

<% int parentRowIndex = Container.DataItemIndex; %>

<asp:Repeater ID="parentRep" runat="Server">
                                               <ItemTemplate>
                                                   <%int parentRowIndex = Container.DataItemIndex;  %>
                                                   <asp:Repeater ID="parentRep" runat="Server">
                                                       <ItemTemplate>
                                                           <%parentRowIndex %>
                                                       </ItemTemplate>
                                                   </asp:repeatere>
                                               </ItemTemplate>
                                           </asp:Repeater>




谢谢,
Imdadhusen




Thanks,
Imdadhusen


这篇关于在子级中继器控件中绑定父级中继器项索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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