方法一(支持分页): 正常情况下,数据绑定的时候GridView模版列内部的数据绑定对象Container是GridViewRow类型,

再根据GridViewRow.Parent.Parent获得当前GridView的引用, 计算出他的当前Index;

<asp:TemplateField HeaderText="序号">

                <ItemTemplate>
                    <asp:Label ID="lblIndexCount" runat="server" Text='<%# ((GridView)((GridViewRow)Container).Parent.Parent).PageIndex * ((GridView)((GridViewRow)Container).Parent.Parent).PageSize + ((GridView)((GridViewRow)Container).Parent.Parent).Rows.Count + 1%>' />
                </ItemTemplate>

            </asp:TemplateField>

相关文章:

  • 2022-01-26
  • 2022-02-02
  • 2021-06-02
  • 2022-12-23
  • 2021-10-13
  • 2022-12-23
  • 2022-01-07
  • 2021-07-13
猜你喜欢
  • 2022-12-23
  • 2021-08-30
  • 2022-02-19
  • 2022-12-23
  • 2021-12-10
相关资源
相似解决方案