提供了个EmptyDataTemplate,可以把header的样式构造到里面去
<
asp:GridView ID
=
"
grdvList
"
runat
=
"
server
"
AutoGenerateColumns
=
"
False
"
CssClass
=
"
DataGrid
"
Width
=
"
720px
"
DataKeyNames = " ROW_REF_ID " OnRowCommand = " grdvList_RowCommand " AllowPaging = " True " AllowSorting = " True "
PageSize = " 5 " OnPageIndexChanging = " grdvList_PageIndexChanging " OnSorting = " grdvList_Sorting " >
< HeaderStyle CssClass = " grid_head " />
< RowStyle CssClass = " grid_row " />
< SelectedRowStyle CssClass = " grid_row_selected " />
< Columns >
< asp:BoundField HeaderText = " Action Code " DataField = " ACTION_CODE " SortExpression = " ACTION_CODE " >
< HeaderStyle Width = " 200px " />
</ asp:BoundField >
< asp:BoundField HeaderText = " Description " DataField = " ACTION_DESCRIPTION " SortExpression = " ACTION_DESCRIPTION " />
< asp:ButtonField HeaderText = " Detail " CommandName = " Detail " Text = " <img src="../Images/BMG_icon_detail.GIF" alt='Detail'; border=0> " >
< HeaderStyle Width = " 45px " />
</ asp:ButtonField >
< asp:ButtonField HeaderText = " Delete " CommandName = " InActive " Text = " <img src="../Images/BMG_icon_delete.GIF" border=0; alt='delete'> " >
< HeaderStyle Width = " 45px " />
</ asp:ButtonField >
< asp:ButtonField HeaderText = " Active " CommandName = " Active " Text = " <img src="../Images/BMG_icon_detail.GIF" border=0; alt='active'> " >
< HeaderStyle Width = " 45px " />
</ asp:ButtonField >
< asp:BoundField HeaderText = " ROW_REF_ID " DataField = " ROW_REF_ID " Visible = " False " />
</ Columns >
< EmptyDataTemplate >
< table frame = " void " cellspacing = " 0 " cellpadding = " 0 " border = " 1 " style = " width:720px;border-collapse:collapse; " >
< tr class = " grid_head " >
< th scope = " col " style = " width:200px; " > Action Code </ th >
< th scope = " col " > Description </ th >
< th scope = " col " style = " width:45px; " > Detail </ th >
< th scope = " col " style = " width:45px; " > Delete </ th >
</ tr >
< tr class = " grid_row " >
< td colspan = " 4 " align = " right " > 1 </ td >
</ tr >
</ table >
</ EmptyDataTemplate >
</ asp:GridView >
DataKeyNames = " ROW_REF_ID " OnRowCommand = " grdvList_RowCommand " AllowPaging = " True " AllowSorting = " True "
PageSize = " 5 " OnPageIndexChanging = " grdvList_PageIndexChanging " OnSorting = " grdvList_Sorting " >
< HeaderStyle CssClass = " grid_head " />
< RowStyle CssClass = " grid_row " />
< SelectedRowStyle CssClass = " grid_row_selected " />
< Columns >
< asp:BoundField HeaderText = " Action Code " DataField = " ACTION_CODE " SortExpression = " ACTION_CODE " >
< HeaderStyle Width = " 200px " />
</ asp:BoundField >
< asp:BoundField HeaderText = " Description " DataField = " ACTION_DESCRIPTION " SortExpression = " ACTION_DESCRIPTION " />
< asp:ButtonField HeaderText = " Detail " CommandName = " Detail " Text = " <img src="../Images/BMG_icon_detail.GIF" alt='Detail'; border=0> " >
< HeaderStyle Width = " 45px " />
</ asp:ButtonField >
< asp:ButtonField HeaderText = " Delete " CommandName = " InActive " Text = " <img src="../Images/BMG_icon_delete.GIF" border=0; alt='delete'> " >
< HeaderStyle Width = " 45px " />
</ asp:ButtonField >
< asp:ButtonField HeaderText = " Active " CommandName = " Active " Text = " <img src="../Images/BMG_icon_detail.GIF" border=0; alt='active'> " >
< HeaderStyle Width = " 45px " />
</ asp:ButtonField >
< asp:BoundField HeaderText = " ROW_REF_ID " DataField = " ROW_REF_ID " Visible = " False " />
</ Columns >
< EmptyDataTemplate >
< table frame = " void " cellspacing = " 0 " cellpadding = " 0 " border = " 1 " style = " width:720px;border-collapse:collapse; " >
< tr class = " grid_head " >
< th scope = " col " style = " width:200px; " > Action Code </ th >
< th scope = " col " > Description </ th >
< th scope = " col " style = " width:45px; " > Detail </ th >
< th scope = " col " style = " width:45px; " > Delete </ th >
</ tr >
< tr class = " grid_row " >
< td colspan = " 4 " align = " right " > 1 </ td >
</ tr >
</ table >
</ EmptyDataTemplate >
</ asp:GridView >