Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding Combo To DataGridView
Message
 
À
22/12/2009 17:19:21
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01440197
Message ID:
01440238
Vues:
29
>Are you using a datadrid or datagridview?
>
>If it's a datagridview, it's datagridviewcomboxcolumn.

DataGridView.

Here's what I have so far:
private void _TableSelected()
{
    _TableId = (int)cboTables.SelectedValue;
    dsGrid = DataProcs.ExecuteQuery("SELECT ColumnId, TableId, ColumnName, Expression FROM Columns WHERE TableId = " + _TableId, CommandType.Text);

    grdColumns.DataSource = null;
    grdColumns.DataMember = null;

    if (dsGrid.Tables[0].Rows.Count > 0)
    {
        grdColumns.DataSource = dsGrid.Tables[0];
        grdColumns.Columns[0].Visible = false;
        grdColumns.Columns[1].Visible = false;
        grdColumns.Columns[2].Width = 200;
        grdColumns.Columns[3].Width = 490;

        grdColumns.Columns[2].HeaderText = "Column Name";
        grdColumns.Columns[3].HeaderText = "Expression";
    }

    // THIS IS THE PART THAT DOES NOT WORK
    dsTables = DataProcs.ExecuteQuery("SELECT TableId, QueryName FROM Tables ORDER BY TableName");
    DataGridViewComboBoxColumn colTables = new DataGridViewComboBoxColumn();
    colTables.Name = "colTables";
    colTables.DataSource = dsTables.Tables[0];
    grdColumns.Columns.Add(colTables);
}
My combo appears with nothing in it.
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform