为了理解Repeater控件,今天做了个试验:

Repeater控件ItemCreated事件中的ItemIndexprotected void Repeater1_ItemCreated(object sender, RepeaterItemEventArgs e)
        }


输出的结果如下:

Label
Index:<< -1 >> ------ Type:<< Header >>
Index:<< 0 >> ------ Type:<< Item >>
Index:<< 1 >> ------ Type:<< AlternatingItem >>
Index:<< 2 >> ------ Type:<< Item >>
Index:<< 3 >> ------ Type:<< AlternatingItem >>
Index:<< 4 >> ------ Type:<< Item >>
Index:<< -1 >> ------ Type:<< Footer >>


由此可见:

Header,Footer没有Index,所以用 -1 代替.
Item与AlternatingItem的Index是一起算的.

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-30
  • 2022-02-12
  • 2021-05-18
  • 2022-02-24
相关资源
相似解决方案