日期:2014-05-17 浏览次数:20496 次
Dim tcHeader As TableCellCollection = oGridCells tcHeader.Clear() tcHeader.Add(New TableHeaderCell) tcHeader(0).Attributes.Add("rowspan", "2") tcHeader(0).Text = dtGrid.Columns.Item("Com_ID").Caption
------解决方案--------------------
在对数据库中操作的sql语句中字段后空格 加上别名就行
像这样
sleect Com_ID 公司ID.......
------解决方案--------------------
protected void gvList_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
foreach(TableCell cell in e.Row.Cells)
{
cell.Text = "xxxxx";
}
}
}
<asp:GridView ID="gvList" runat="server" OnRowCreated="gvList_RowCreated">
或者protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e)里面