http://xml.sz.luohuedu.net/xml/ShowDetail.asp?id=F73EF6AD-6878-4748-B963-5181252E5AED

解决方案 »

  1.   

    可以把添加一个bool列,转换一下.
    添加dataGridBoolColumn1,设置MappingName为该bool列就可以了。
      

  2.   

    可以在<asp:datagrid id="myStyleCGrid" runat="server" Height="95%" Width="600px" BorderStyle="None" BorderColor="#CC9966" AutoGenerateColumns="False" BorderWidth="1px" CellPadding="1" OnItemDataBound="ItemDataBound" OnItemCreated="ItemCreated">,然后:
    /// <summary>
    /// 控制网格显示风格
    /// </summary>
    public void ItemDataBound(Object sender, DataGridItemEventArgs e)
    {
    int intCellCount=e.Item.Cells.Count;
    DataRowView drv = (DataRowView) e.Item.DataItem;
    if (drv == null) return; #region 控制网格显示风格
    //序号
    if (drv["序号"]!=null)
    {
    e.Item.Cells[0].Attributes["Width"]="30px";
    e.Item.Cells[0].Attributes["Height"]="18px";
    }
    //是否显示
    if (drv["是否显示"]!=null)
    {
    TableCell tc = e.Item.Cells[3];
    tc.Attributes["Width"]="50px";
    string strTemp=tc.Text.Trim();
    CheckBox cb = new CheckBox();

    cb.ID="cb"+e.Item.Cells[3].ClientID;
    tc.Attributes["Align"]="center"; 
    if (drv["是否显示"].ToString()!="0")
    cb.Checked=true; 
    else
    cb.Checked=false; 
    //cb.Enabled=!(drv["mustdisp"].ToString().Equals("1"));
    tc.Controls.Add(cb);
    }
    ......
    }