实现方法就是给单元格填充我们想要的格式代码。
C#
<%@ Page Language="C#" AutoEventWireup="true" %><br /><!doctype html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"<br />"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br /><br /><html xmlns="http://www.w3.org/1999/xhtml"><br /> <head><br /> <title>为 GridView 添加多层表头</title><br /> </head><br /> <body><br /> <form id="Form1" runat="server"><br /> <asp:gridview ID="GridView1" runat="server" CellSpacing="1" CellPadding="3" Font-Size="12px"<br /> Width="600px" BackColor="#000000" BorderWidth="0" OnRowDataBound="GridView1_RowDataBound"<br /> OnRowCreated="GridView1_RowCreated"><br /> </asp:gridview><br /> </form><br /> </body><br /></html><br />