Centering a Sortable Row Header in the GridView
I cannot seem to center the header text of a column in my GridView if it is sortable. The html output is much different for a sortable column (it seems to place a table inside of the td column).
Any thoughts on what can be done to get this centered? I put the html ouput in a jsfiddle开发者_C百科 here ... http://jsfiddle.net/mcox05/85Euq/
I have tried the following code on the grid view with no success. Bear in mind that the bound fields are server controls I designed but they do not affect the header text in any fashion: I am open to any css, js, or asp.net fix that can correct this issue. Thanks!
<sc:DateBoundField DataField="LastLogin" SortExpression="LastLogin" HeaderText="Last Login"
HeaderStyle-Width="125px" ItemStyle-Width="125px" HeaderStyle-HorizontalAlign="Center" />
<sc:SCommandButtonField Command="Change" ItemStyle-Width="100px" HeaderStyle-Width="100px"
HeaderText="Change" HeaderStyle-HorizontalAlign="Center" Image="img.axd?ico16=edit" />
If you can get the style of your inner table to look like style="height: 32px; cursor: pointer; font-weight: bold; margin:auto;"
it will center, at least in FF.
精彩评论