Gridview无数据时显示表头的问题

提供了个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 = " &lt;img src=&quot;../Images/BMG_icon_detail.GIF&quot; alt='Detail'; border=0&gt; "   >
                                
< HeaderStyle Width = " 45px "   />
                            
</ asp:ButtonField >
                            
< asp:ButtonField HeaderText = " Delete "  CommandName = " InActive "  Text = " &lt;img src=&quot;../Images/BMG_icon_delete.GIF&quot; border=0; alt='delete'&gt; " >
                                
< HeaderStyle Width = " 45px "   />
                            
</ asp:ButtonField >
                            
< asp:ButtonField HeaderText = " Active "  CommandName = " Active "  Text = " &lt;img src=&quot;../Images/BMG_icon_detail.GIF&quot; border=0; alt='active'&gt; " >
                                
< 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 >
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值