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
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
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 }
}
where to add items in comboBox1?
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
}
Thanks abelLazm :) You are really great help for me always :D Thanks again
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.