[ASP.NET]格式化 DataGrid 输出
http://www.6gee.com/more.asp?name=yulin&id=418DataGrid删除确认及Item颜色交替
http://www.donews.net/blueoxygen/archive/2004/04/17/12864.aspx

解决方案 »

  1.   

    skyeenet(一心一意进微软) ( ) 信誉:100 
    能给出示例代码吗?
    谢谢!
      

  2.   

    private void AddCustomDataTableStyle()
       {
          DataGridTableStyle ts1 = new DataGridTableStyle();
          ts1.MappingName = "Customers";
          // Set other properties.
          ts1.AlternatingBackColor = Color.LightGray;      /* Add a GridColumnStyle and set its MappingName 
          to the name of a DataColumn in the DataTable. 
          Set the HeaderText and Width properties. */
          
          DataGridColumnStyle boolCol = new DataGridBoolColumn();
          boolCol.MappingName = "Current";
          boolCol.HeaderText = "IsCurrent Customer";
          boolCol.Width = 150;
          ts1.GridColumnStyles.Add(boolCol);
          
          // Add a second column style.
          DataGridColumnStyle TextCol = new DataGridTextBoxColumn();
          TextCol.MappingName = "custName";
          TextCol.HeaderText = "Customer Name";
          TextCol.Width = 250;
          ts1.GridColumnStyles.Add(TextCol);
         /* Add the DataGridTableStyle instances to 
          the GridTableStylesCollection. */
          myDataGrid.TableStyles.Add(ts1);   }