还有除了DATAGRID有没有其它更好的表格控件啊!

解决方案 »

  1.   

    win的还是web的?2者好象实现的方式不一样的
      

  2.   

    唉!这样吧!也就是在DataGrid指定的表格中绘制一些图片和控件!
    比如!让一个下拉式列表在能在表格中显示!
    我是在Winform下做的!
      

  3.   

    private void button2_Click(object sender, System.EventArgs e)
    {
    OleDbCommand dd = m_adoapp.OleConnectionInstance.CreateCommand();
    dd.CommandText  = "select * from tb_users"; OleDbDataAdapter ad = new OleDbDataAdapter("select * from tb_users",m_adoapp.OleConnectionInstance);
    ad.Fill(a);
    DataView dv = new DataView(a);
    dv.AllowNew = false;
    this.dataGrid1.DataSource = dv;
    this.dataGrid1.ReadOnly   = true; this.dataGrid1.AlternatingBackColor = System.Drawing.Color.Silver; cbx = new ComboBox();
    cbx.Name = "cbx"; cbx.Visible = false; cbx.Items.Clear(); cbx.Items.Add("Sales Representative"); cbx.Items.Add("Inside Sales Coordinator"); cbx.Items.Add("Vice President, Sales"); cbx.Items.Add("Sales Manager"); cbx.Items.Add("Flunky");
    cbx.TextChanged += new EventHandler(cbx_TextChanged); this.dataGrid1.Controls.Add(cbx);

    } private void cbx_TextChanged(object sender, System.EventArgs e)
    {

                          this.dataGrid1[this.dataGrid1.CurrentCell] = cbx.Text; }
    private void dataGrid1_CurrentCellChanged(object sender, System.EventArgs e)
    {
    if(this.dataGrid1.CurrentCell.RowNumber == 0 && this.dataGrid1.CurrentCell.ColumnNumber == 0)
    this.dataGrid1.ReadOnly = true;
    else
    this.dataGrid1.ReadOnly = false; if( this.dataGrid1.CurrentCell.ColumnNumber == 3)
    {            cbx.Visible = false;            cbx.Width = 0;            cbx.Left = this.dataGrid1.GetCurrentCellBounds().Left;            cbx.Top = this.dataGrid1.GetCurrentCellBounds().Top;            cbx.Text = this.dataGrid1[this.dataGrid1.CurrentCell].ToString() ; cbx.Visible = true;
    }
    else
    {
                        cbx.Visible = false; cbx.Width = 0; } } private void dataGrid1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
    {
    if(this.dataGrid1.CurrentCell.ColumnNumber == 3)
    {
    cbx.Width = this.dataGrid1.GetCurrentCellBounds().Width;
    }             } private void dataGrid1_Scroll(object sender, System.EventArgs e)
    {
    cbx.Visible = false; cbx.Width = 0;
    }