项目要求将GridView控件的标题解析成这样,请高手指教
        <tr style="height: 25px">
            <td style="width: 70px" align="center">
                開発符号</td>
            <td style="width: 50px" align="center">
                仕向地</td>
            <td style="width: 40px" align="center">
                ロット</td>
            <td style="width: 80px" align="center">
                <span style="color: #ff0000">*</span>Prj識別</td>
            <td style="width: 280px" align="center">
                <span style="color: #ff0000">*</span>アクセス権限</td>
            <td style="width: 555px" align="center">
                <span style="color: #ff0000">*</span>Project担当者</td>
            <td style="width: 280px" align="center">
                XRP簡易仕様書</td>
            <td align="center" style="width: 320px">
                備考</td>
            <td style="width: 35px" align="center">
                非表示</td>
            <td style="width: 35px" align="center">
                削除</td>
        </tr>

解决方案 »

  1.   

    <span style="color: #ff0000"> * </span>能不能在属性设定的时候把HeaderText设定成这样?
      

  2.   

    建议你Search一下GridView的自定义表头,应该能找到你需要的!
      

  3.   

    看到GridView是解析成表格形式的
      

  4.   


    protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Header)
            {
                e.Row.Attributes.Add("style", "height:25px");
                e.Row.Cells[0].Attributes.Add("style", "width:70px;align:center");
                e.Row.Cells[1].Attributes.Add("style", "width:50px;align:center");
                e.Row.Cells[2].Attributes.Add("style", "width:40px;align:center");
                e.Row.Cells[3].Attributes.Add("style", "width:80px;align:center");
                e.Row.Cells[3].Text = "<span style='color: #ff0000'> * </span>" + e.Row.Cells[i].Text;
                ...
            }
         }
      

  5.   

    何必那么麻烦呢,直接在ItemStyle中设置就可以了。
    例如我是这样设置的:
    <asp:BoundField DataField="product_name" HeaderText="产品名称" SortExpression="product_name" ItemStyle-Width="400px" />
    就是一个ItemStyle-Width="235px",其他的自己去找。
      

  6.   

    还有就是center的问题,可以把gridview放在一个div中,然后设置文本对齐方式为居中。