2011-07-15 36 views

回答

5

這是舊的ASP.NET 2.0天。 ASP.NET 4.0允許我們將其指定爲一個asp:GridView財產

MSDN鏈接

  1. SortedAscendingHeaderStyle
  2. SortedDescendingHeaderStyle

GridView的標記

<SortedAscendingHeaderStyle CssClass="sortasc" /> 
<SortedDescendingHeaderStyle CssClass="sortdesc" /> 

CSS

.datatable th 
{ 
    font-size:12px; 
    font-weight:bold; 
    letter-spacing:0px; 
    text-align:left; 
    padding:2px 4px; 
    color:#333333; 
    border-bottom:solid 2px #bbd9ee; 
} 
.datatable th a 
{ 
    text-decoration:underline; 
    padding-right:18px; 
    color:#000; 
} 
.datatable th.sortasc a { background:url(../Images/asc.gif) right center no-repeat; } 
.datatable th.sortdesc a { background:url(../Images/desc.gif) right center no-repeat; } 

請注意asp:GridView已分配CssClass="datatable"

你可能也想看看SortedAscendingCellStyleSortedDescendingCellStyle

對於老式方法,試試這個。 http://mattberseth.com/blog/2007/10/a_yui_datatable_styled_gridvie.html

+1

在'GridView'中添加兩個類和標記不能爲我工作,不幸的是 – Si8

+0

您可以添加另一個問題。將看看它 – naveen

+0

我用RowCreated方法去,我有它的工作。謝謝 – Si8

相關問題