Use of Asp.net gridview

Source: Internet
Author: User

1. First, an example

<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"> View </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. Small issues related to the gridview

Border removal: borderstyle = "NONE" cellpadding = "0" gridlines = "NONE"

Add automatic serial number:

<Itemtemplate>
<% # Container. dataitemindex + 1%>
</Itemtemplate>

E. Row. cells [0]

Header removal: This. Maid = false;

Showheader = "false"

Set style:

Rowstyle is a regular row style, which is the same as setting tr. Selectedrowstyle: the style of the selected row. I don't know if it is the style at the bottom of the pagerstyle with the mouse placed on a row. The last line should be the style of the headers of headerstyle, which is the title, such as number, name, alternatingrowstyle.

 

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.