We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

GridControl ComboBox events

hi
i use GridControl ComboBox to load data from table in data base
i want when i change the in ComboBox or close up the combobox
load anthother data from another table and put them in other col
======================

Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" & Application.StartupPath & "\databind.mdb")
Dim cmd As New OleDbCommand()

Dim da As New OleDbDataAdapter()
Dim ds As New DataSet()

con.Open()
With cmd

.Connection = con
.CommandType = CommandType.TableDirect
.CommandText = "select*from Categories"

End With
da.SelectCommand = cmd
da.Fill(ds, "Categories")
Me.GridControl1.ColStyles(2).CellType = "ComboBox"
Me.GridControl1.ColStyles(2).DropDownStyle = Syncfusion.Windows.Forms.Grid.GridDropDownStyle.Exclusive
Me.GridControl1.ColStyles(2).DataSource = ds.Tables(0)
Me.GridControl1.ColStyles(2).DisplayMember = "CategoryName"
Me.GridControl1.ColStyles(2).ValueMember = "CategoryID"
Me.GridControl1.CurrentCell.ShowDropDown()
============================
i want to print CategoryID in col (1)


8 Replies

RB Ragamathulla B Syncfusion Team November 10, 2011 10:05 AM UTC

Hi Reda,

Thanks for the update.

To achieve the desired behavior. please refer the dashboard sample “GDBG Combo Columns Demo” . The following path contains the sample from the dashboard.

..\..\AppData\Local\Syncfusion\EssentialStudio\{installedVersion}\Windows\Grid.Windows\Samples\2.0\Data Bound\GDBG Combo Columns Demo

Let me know if you have any concern.

Regards,
Ragamathullah B



RE reda November 10, 2011 11:00 AM UTC

i see the Sample and there is no event using in the Sample



RE reda November 10, 2011 11:33 AM UTC

pl give me some help



RB Ragamathulla B Syncfusion Team November 11, 2011 04:12 AM UTC

Hi Reda,

Thanks for the update.

The combobox load another data from another table and putting them in other column/row by using ‘CurrentCellCloseDropDown’ event. The following code explains the same

void gridControl1_CurrentCellCloseDropDown(object sender, Syncfusion.Windows.Forms.PopupClosedEventArgs e)
{
ArrayList array = new ArrayList();
array.Add(new MyClass(001, "John David"));
array.Add(new MyClass(002, "Tom"));
array.Add(new MyClass(003, "Bretney"));
array.Add(new MyClass(004, "Jessy"));
array.Add(new MyClass(005, "Bruch"));
array.Add(new MyClass(006, "Johny"));
this.gridControl1[3, 1].CellType = "ComboBox";
this.gridControl1[3, 1].DisplayMember = "Name";
this.gridControl1[3, 1].ValueMember = "ID";
this.gridControl1[3, 1].DataSource = array;
}

Please refer to the following sample which illustrates the same.

http://www.syncfusion.com/downloads/Support/DirectTrac/87137/GCComboBoxEvent-1789723124.zip

Please let me know if you have any further concerns.

Regards,
Ragamathullah B.




RE reda November 11, 2011 08:54 AM UTC

thank you so much it worked but if i use GridListControl instead of combo how can i change column display name of GridListControl
============
sorry if board you and thank you again for your help



RB Ragamathulla B Syncfusion Team November 14, 2011 11:57 AM UTC

Hi Reda,

Thanks for update.

You can change the display column when closed the dropdown by using 'CurrentCellCloseDropDown' event. The following code explains the same.

void gridControl1_CurrentCellCloseDropDown(object sender, PopupClosedEventArgs e)
{
gridControl1[6, 3].CellType = "GridListControl";
gridControl1[6, 3].DataSource = dataSet11.Customers;
gridControl1[6, 3].DisplayMember = "CustomerID";
gridControl1[6, 3].ValueMember = "CustomerID";
}


Please refer to the sample which illustrates the same.

http://www.syncfusion.com/downloads/Support/DirectTrac/87211/ComboBoxGLC1591933118.zip

please let me know if you have any further concerns.

Regards,
Ragamathullah B



RE reda November 14, 2011 01:20 PM UTC

sorry i dont mean columns i mean change the header columns caption for GridListControl
=============================
i mean the header of columns caption
im sorry
and thank you for helping



RB Ragamathulla B Syncfusion Team November 18, 2011 03:45 AM UTC

Hi Reda,

Thank you for the update.

We will update you with the respective details for your reported queries, in the Forum 101738. Please refer the forum 101738 for follow up. also We suggest you to logon your forum account with your username and password to view.

Here is the link:

http://www.syncfusion.com/support/forums/general/101738

Let me know if you have any concern.

Regards,
Ragamathullah B


Loader.
Live Chat Icon For mobile
Up arrow icon