为DataList和GridView内容项添加序号
生活随笔
收集整理的這篇文章主要介紹了
为DataList和GridView内容项添加序号
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
DataList就在需要的地方加入這么一個Label就可以了,主要的地方就是那個Container.ItemIndex+1,+1是因為DataList的編號是從0開始的
<asp:Label?ID="lblQNum"?runat="server"?Text='<%#?Container.ItemIndex+1?%>'?Font-Bold="True"></asp:Label>
GridView也類似,稍微有點點不同,注意是DataItemIndex
<asp:Label?ID="lblSNum"?runat="server"?Text='<%#?Container.DataItemIndex+1?%>'></asp:Label>
<asp:Label?ID="lblQNum"?runat="server"?Text='<%#?Container.ItemIndex+1?%>'?Font-Bold="True"></asp:Label>
GridView也類似,稍微有點點不同,注意是DataItemIndex
<asp:Label?ID="lblSNum"?runat="server"?Text='<%#?Container.DataItemIndex+1?%>'></asp:Label>
轉載于:https://www.cnblogs.com/mFrog/archive/2008/06/04/1213168.html
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的为DataList和GridView内容项添加序号的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 软件质量保证与测试
- 下一篇: 慕课版软件质量保证与测试(第四章.课后作