zoukankan      html  css  js  c++  java
  • GridView加自动编号列

    <asp:GridView ID="GridView1" runat="server"
     AutoGenerateColumns="False" SortAscImageUrl="..\Images\arrow-up.gif" SortDescImageUrl="..\Images\arrow-down.gif"   DataKeyNames="Title" UpdateAfterCallBack="True" Width="99%" BackColor="#E8E8E8" BorderColor="#B9B9B9"  AddSequenceColumn="False" BorderStyle="Solid" BorderWidth="1px" CellPadding="0" DeletePromptText="确实要删除指定的记录吗?" FixHeader="False"  Del="False" Edit="False" EnableCallBack="False" PageSize="19" AllowMultiColumnSorting="False"  GridViewSortDirection="Ascending" >
                            <Columns>
                                <asp:TemplateField HeaderText="序号" InsertVisible="False" >
                                     <headerstyle width="7%" horizontalalign="Center" />
                                     <ItemTemplate>
                                        <asp:Label id="Label2" runat="server" Width="100%" Text="<%# this.GridView1.PageIndex * this.GridView1.PageSize  + this.GridView1.Rows.Count + 1 %>" ForeColor="Red"></asp:Label>
                                     </ItemTemplate>
                                </asp:TemplateField>
                               
                                <asp:BoundField DataField="Title" HeaderText="标题" SortExpression="Title">
                                <headerstyle width="12%" horizontalalign="Center" />
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:BoundField DataField="CreateDate" HeaderText="创建时间" SortExpression="CreateDate" DataFormatString="{0:yyyy-MM-dd}" HtmlEncode="False">
                                <headerstyle width="11%" horizontalalign="Center" />
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:BoundField DataField="HitCount" HeaderText="内容" SortExpression="HitCount">
                                <headerstyle width="20%" horizontalalign="Center" />
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                               
                              
                            </Columns>
                        <PagerStyle BackColor="Gainsboro" BorderStyle="Dotted" ForeColor="#4A3C8C" HorizontalAlign="Right" />
                            <HeaderStyle BackColor="#A8B8D8" HorizontalAlign="Left" Height="22px" Font-Bold="True" />
                            <SelectedRowStyle BackColor="#E8E8E8" />
                            <AlternatingRowStyle BackColor="#E0E0E8" />
                       
                        </asp:GridView>
  • 相关阅读:
    属性序列化自定义与字母表排序-JSON框架Jackson精解第3篇
    URL及日期等特殊数据格式处理-JSON框架Jackson精解第2篇
    JSON数据处理框架Jackson精解第一篇-序列化与反序列化核心用法
    开源项目-跨项目及操作系统的通用代码生成器,解放您的双手
    图解并发与并行-分别从CPU和线程的角度理解
    8成以上的java线程状态图都画错了,看看这个-图解java并发第二篇
    面霸告诉你这些技术面试的非技术性经验,让你的面试成功率显著提升
    List集合对象去重及按属性去重的8种方法-java基础总结系列第六篇
    图解进程线程、互斥锁与信号量-看完不懂你来打我
    总结java中文件拷贝剪切的5种方式-JAVA IO基础总结第五篇
  • 原文地址:https://www.cnblogs.com/bluedy1229/p/1104827.html
Copyright © 2011-2022 走看看