如何网格的字段行显示成下面的样式:
 -------------------------------------------
∣     ∣      ∣被检查人签字 ∣           ∣
∣ 编号∣ 问题  ---------------  整改      ∣   '实现这一行的样式,字段分两行表格显示
∣     ∣      ∣管理员∣ 领导∣           ∣
 -------------------------------------------
∣ 1   ∣不严格∣  王二∣孙武 ∣ 完毕      ∣
 -------------------------------------------
∣ 2   ∣误操作∣  李四∣张含 ∣ 未完      ∣
 -------------------------------------------
∣ 3   ∣漏写  ∣  张三∣李伟 ∣ 开始      ∣
 -------------------------------------------
∣ 4   ∣忽视  ∣  赵六∣许丰 ∣ 开始      ∣
 -------------------------------------------

解决方案 »

  1.   

    DataGrid显示双层表头假设你的DataGrid有三列,现在想将前两列作为"大类1",第三列作为"大类2",现在,你可以在ItemDataBound事件中加入下面的代码:if (e.Item.ItemType == ListItemType.Header){e.Item.Cells[0].ColumnSpan = 2;e.Item.Cells[0].Text = "大类1</td><td>大类2</td></tr><tr><td>" + e.Item.Cells[0].Text;}
      

  2.   

    显示错误“System.EventArgs”并不包含对“Item”的定义
      

  3.   

    怎么找到ItemDataBound事件,能给个事件体的代码吗?
      

  4.   

    this.DataGridLogininfo.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.DataGridLogininfo_ItemDataBound); private void DataGridLogininfo_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
    {
    ListItemType itemType = e.Item.ItemType;
    if (itemType == ListItemType.Item )
    {

    e.Item.Attributes["onmouseout"] = "javascript:this.style.backgroundColor='#dedfde';";
    e.Item.Attributes["onmouseover"] = "javascript:this.style.backgroundColor='#fff7ce';cursor='hand';" ; }
    else if( itemType == ListItemType.AlternatingItem)
    {
    e.Item.Attributes["onmouseout"] = "javascript:this.style.backgroundColor='#ffffff';";
    e.Item.Attributes["onmouseover"] = "javascript:this.style.backgroundColor='#fff7ce';cursor='hand';" ;
    }
    }