给你个提示,在数据绑定时index 0行e.item是标题内容.可尝试设空值

解决方案 »

  1.   

    <asp:DataGrid id="DataGrid1" runat="server" HeaderStyle-HorizontalAlign="Center" OnItemDataBound="DataGrid1_ItemBound"/>void DataGrid1_ItemBound(object sender,  DataGridItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Header)
            e.Item.Cells[n].Text = "";
    }
      

  2.   

    如果从数据库取数据,select 字段1 as "字段名字" from 表,as后显示的就是列标题。
      

  3.   

    or.....
    DataGrid1.DataBind();
    Table t = (Table)DataGrid1.Controls[0];
    t.Rows[0].Cells[n].Text = "";
      

  4.   

    id          course orderid   classroom_id    ghdate 
     18  CHINESE  221    A1       2002-8-18 
    思归,用你的代码最后结果如上,虽然隐藏掉id后面的name列,可是课程开始错位,怎么办?列是用foreach隐藏的.dgi.cells[n].visible=false!请指教
      

  5.   

    ....
    DataGrid1.DataBind();
    Table t = (Table)DataGrid1.Controls[0];
    foreach (TableRow tr in t.Rows)
       tr.Cells[n].Visible = false;
      

  6.   

    you are working too hard, you could have doneDataTable1.Columns.RemoveAt(n);
    DataGrid1.DataSource = DataTable1.DefaultView;
    ....