0

hello,

Can any one help me in C1TrueDBGrid? I want to add a dropdown column in my C1TrueDBGrid which has different values for each row and on index change it changes value another cell of the row

Thanks in advance

2
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by bahed121
Featured Replies
  • Write this code when you load your c1truedbgrid [CODE]dataSet1.Tables[0].Columns.Add("DropDown_Column_name");// adds an empty column in dataset C1TDBGrid1.Columns["DropDown_Column_name"].Editor = comboBox1;// C1TDBGrid1.Columns["DropDown_Column_name"].ValueItems.Translate = true; C1TDBGrid1.Splits[0].DisplayColumns["DropDown_Column_name"].DropDownList = true; C1TDBGrid1.Splits[0].DisplayColumns["DropDown_Column_name"].Locked = false; C1TDBGrid1.Splits[0].DisplayColumns["DropDown_Column_name"].FetchStyle = true; C1TDBGrid1.MoveFirst(); for (int o = 0; o < C1TDBGrid1.RowCount; o++) { C1TDBGrid1.Columns["DropDown_Column_name"].Text = "Select"; C1TDBGrid1.MoveNext(); }[/CODE] then on comboBox1Selectionchange event … Read More

  • The reason to load values on mouse click is to update it with every row [CODE]void comboBox1_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) { // Query to values in comboBox1 }[/CODE] Read More

1

Write this code when you load your c1truedbgrid

dataSet1.Tables[0].Columns.Add("DropDown_Column_name");// adds an empty column in dataset
  C1TDBGrid1.Columns["DropDown_Column_name"].Editor = comboBox1;//
  C1TDBGrid1.Columns["DropDown_Column_name"].ValueItems.Translate = true;
  C1TDBGrid1.Splits[0].DisplayColumns["DropDown_Column_name"].DropDownList = true;
  C1TDBGrid1.Splits[0].DisplayColumns["DropDown_Column_name"].Locked = false;
  C1TDBGrid1.Splits[0].DisplayColumns["DropDown_Column_name"].FetchStyle = true;
 C1TDBGrid1.MoveFirst();
  for (int o = 0; o < C1TDBGrid1.RowCount; o++)
     {
          C1TDBGrid1.Columns["DropDown_Column_name"].Text = "Select";
          C1TDBGrid1.MoveNext();
             }

then on comboBox1Selectionchange event write this code

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.SelectedText.Contains("Select"))
            {
                MessageBox.Show("Nothing is selected");
            }
            else
            { //Proceed with your code
                C1TDBGrid1.Columns["Column_to_change_on_click"].Value = "Changed Value";
             //Proceed with your code   }
        }
Votes + Comments
good post
1

The reason to load values on mouse click is to update it with every row

void comboBox1_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e)
        {
          //  Query to values in comboBox1


        }
0

Thanks abelLazm :) You are really great help for me always :D Thanks again

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.