1、 以下的前台自定义表头:            
 <asp:BoundField DataField="档案编号" HeaderText="档案编号" ControlStyle-Width="10px" />                   
<asp:BoundField DataField="姓名" HeaderText="姓名" />               
<asp:BoundField DataField="性别码" HeaderText="性别" />            
<asp:BoundField DataField="出生日期" HeaderText="出生日期" />
 <asp:BoundField DataField="民族代码" HeaderText="民族" />
2、因为GridView在没有数据时是不能显示表头的所以我在后台添加了一个空行如下:
            DataTable dt = new DataTable();
            dt.Columns.Add("档案编号");
            dt.Columns.Add("姓名");
            dt.Columns.Add("性别码");
            dt.Columns.Add("出生日期");
            dt.Columns.Add("民族代码");
            if (dt.Rows.Count == 0)
            {                dt.Rows.Add(dt.NewRow());            }
            this.GridView1.DataSource = dt;
            this.GridView1.DataBind();
            int columnCount = dt.Columns.Count;
            GridView1.Rows[0].Cells.Clear();
            GridView1.Rows[0].Cells.Add(new TableCell());
            GridView1.Rows[0].Cells[0].ColumnSpan = columnCount;
            GridView1.Rows[0].Cells[0].Text = "请选择所要查询的村小组";
            GridView1.Rows[0].Cells[0].Style.Add("text-align", "center");我打开页面时我用JS固定了表头,让GridView在滚动时表头固定
但当我点击查询时内容能显示出来后,可固定的表头和GridView的内容不能对齐。
不知道是那出了问题。