I have a GridView that has different width of different cells in its Header. I want to get specific size of each cell since I have a scroll bar from left to right. What I have up to now is what the following:
And what I want is to have something like the following:
表格的风格是:
<style type="text/css">
.fixedColumn .fixedTable td
{
color: #FFFFFF;
background-color: #5097d1;
font-size: 14px;
font-weight: normal;
}
.fixedHead td, .fixedFoot td
{
color: #FFFFFF;
/*background-color: #5097d1;*/
font-size: 14px;
font-weight: normal;
padding: 5px;
border: 1px solid #187BAF;
width: 600px;
}
.fixedTable td
{
font-size: 10pt;
background-color: #FFFFFF;
padding: 5px;
/*text-align: left;*/
border: 1px solid #CEE7FF;
}
</style>
EDIT: I used the following code:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if ((e.Row.RowType == DataControlRowType.Header) || (e.Row.RowType == DataControlRowType.DataRow))
{
foreach (TableCell c in e.Row.Cells){
c.Wrap=true;
c.Width = Unit.Percentage(100);
}
}
}
And the header are changed a little bit and I don t know why as shown below: