惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Security Latest
Security Latest
Recent Commits to openclaw:main
Recent Commits to openclaw:main
O
OpenAI News
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
L
LINUX DO - 最新话题
N
News | PayPal Newsroom
S
Secure Thoughts
The Last Watchdog
The Last Watchdog
Help Net Security
Help Net Security
V2EX - 技术
V2EX - 技术
W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园_首页
博客园 - 司徒正美
The Cloudflare Blog
D
DataBreaches.Net
Jina AI
Jina AI
L
LINUX DO - 热门话题
宝玉的分享
宝玉的分享
Project Zero
Project Zero
量子位
Spread Privacy
Spread Privacy
Cisco Talos Blog
Cisco Talos Blog
J
Java Code Geeks
T
Troy Hunt's Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
News and Events Feed by Topic
PCI Perspectives
PCI Perspectives
Hugging Face - Blog
Hugging Face - Blog
T
Threat Research - Cisco Blogs
博客园 - 聂微东
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
Threatpost
阮一峰的网络日志
阮一峰的网络日志
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Tailwind CSS Blog
AI
AI
C
CXSECURITY Database RSS Feed - CXSecurity.com
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
Apple Machine Learning Research
Apple Machine Learning Research
Attack and Defense Labs
Attack and Defense Labs
V
V2EX
人人都是产品经理
人人都是产品经理
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
有赞技术团队
有赞技术团队
博客园 - 三生石上(FineUI控件)
Cyberwarzone
Cyberwarzone

博客园 - *小小黄*

List<T>的Sort,Find,Exists等的使用(摘抄) JQuery常用代码1 使用Telerik控件时出现Failed to create designer 的解决方法 Telerik Rad 笔记 一 Silverlight学习笔记四:如何通过自定义ComboBox实现SelectedValue Silverlight学习笔记三:如何自定义DataGrid的Header Silverlight学习笔记二(续) Silverlight学习笔记二:DataGrid 服务器端分页、排序的实现 Silverlight学习笔记一:DataGrid如何处理鼠标的滚轮事件 SQL2005快照 在ASP.NET中使用HTTP压缩 Web注册表单设计样式的研究(下) Web注册表单设计样式的研究(上) 禁用aspx页面的客户端缓存 DataGrid中没有数据时显示表头(转) 在 Windows Vista 上安裝 Reporting Services IIS7中访问Access数据库报错的解决方案 解决“无法删除文件:无法读源文件或磁盘” AjaxControlToolkit中的CalendarExtender被遮挡的解决方法
GridView 笔记 - *小小黄* - 博客园
*小小黄* · 2010-03-15 · via 博客园 - *小小黄*

GridView 序号

(正序)

方法一(不带分页):

<asp:TemplateField HeaderText="序号">
        <ItemTemplate>
<%#(Container as GridViewRow).RowIndex + 1%>
       </ItemTemplate>
</asp:TemplateField>

方法二(带分页):
<asp:TemplateField HeaderText="序号">
       <ItemTemplate>
            <%# this.GridView1.PageIndex * this.GridView1.PageSize + Container.DataItemIndex + 1%>
       </ItemTemplate>
</asp:TemplateField>

(倒序)

方法一(不带分页):

<asp:TemplateField HeaderStyle-Width="30px" HeaderText="序号" ItemStyle-HorizontalAlign="center">
     <ItemTemplate>
         <asp:Label ID="Label1" runat="server" Text='<%#((Container as GridViewRow).DataItem as System.Data.DataRowView).Row.Table.Rows.Count - (Container as GridViewRow).RowIndex%>'></asp:Label>
     </ItemTemplate>
</asp:TemplateField>

方法二(带分页):

<asp:TemplateField HeaderStyle-Width="30px" HeaderText="序号" ItemStyle-HorizontalAlign="center">
     <ItemTemplate>
         <asp:Label ID="Label1" runat="server" Text='<%#((Container as GridViewRow).DataItem as System.Data.DataRowView).Row.Table.Rows.Count - (Container as GridViewRow).RowIndex - (this.gviewList.PageIndex) * this.gviewList.PageSize%>'></asp:Label>
     </ItemTemplate>
</asp:TemplateField>
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/kingboy2008/archive/2010/02/26/5328935.aspx