zoukankan      html  css  js  c++  java
  • asp.net GridView的使用

    1.首先一个例子

    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"
                CssClass="vip_table" GridLines="None" BorderStyle="None" CellPadding="0"
                ShowHeader="False">
                <Columns>
                    <asp:TemplateField HeaderText="">
                        <ItemStyle  />
                        <HeaderStyle  />
                        <ItemTemplate>
                           <table class="vip_table vip_tablebody">
                                <tr>
                                <td width="30px" class="vip_bodynum"><%#Convert.ToInt32(Container.DataItemIndex)+1%></td>
                                <td width="90px" class="vip_bodytd"><a href="#" class="a_detail"><%#Eval("Base_tabletNumber")%></a></td>
                                <td width="120px" class="vip_bodytd"><%# Eval("Base_Family")%></td>
                                <td width="120px" class="vip_bodytd"><%# Eval("Base_MainStyleNo")%></td>
                                <td width="60px" class="vip_bodytd"><%# Eval("Base_VehicleBirthDay")%></td>
                                <td width="120px" class="vip_bodytd vip_bodytdprice"><%# string.Format("{0:C2}",Eval("Base_ExpectPrice")).Split('.')[0]%></td>
                                <td width="90px" class="vip_bodytd"><a href="#" class="a_detail">查看</a></td>
                                <td width="130px" class="vip_bodytd">
                                    <input type="text" name="price" class="vip_price fonttext" /></td>
                                <td width="">
                                    <input type="submit" value="" class="vip_commit" /></td>
                                </tr>
                            </table>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>

            </asp:GridView>

    2.GridView涉及的小问题

       去边框:BorderStyle="None" CellPadding="0" GridLines ="None"

       增加自动序列号:

                  <ItemTemplate>
                  <%#Container.DataItemIndex+1%>
                  </ItemTemplate>

       e.Row.Cells[0]

       去表头:this.dataGridView1.ColumnHeadersVisible = false;

              ShowHeader="False"

       设置样式:

                      RowStyle 就是普通的行的样式,跟你设置tr一样的。 SelectedRowStyle 选中行的样式,不知道是不是鼠标放在某行上的样式 PagerStyle 底部的样式,最后一行应该是 HeaderStyle 头部 的样式,就是标题啊,比如 编号,姓名, AlternatingRowStyle 交替项的样式。

    出处:http://www.cnblogs.com/wuchao/archive/2012/08/15/2640254.html

  • 相关阅读:
    模拟行工程部署记录
    (转)如何将 Excel 文件导入到 Navicat for MySQL 数据库
    (转)Linux下安装firefox最新版
    spring4.x源码下载网盘
    手工下发支付业务以及日志查看过程
    在java web中获取该项目的根路径
    在js代码中调用jsp的变量
    ibtais中把clob数据类型转换成string并展示到前台
    ibtais中把clob数据类型转换成string并插入到数据库中
    spring报错:Caused by: java.lang.IllegalStateException: Cannot convert value of type for property : no matching editors or conversion strategy found
  • 原文地址:https://www.cnblogs.com/wuchao/p/2640254.html
Copyright © 2011-2022 走看看