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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Changing datasource of Combobox at runtime

Thread ID:

Created:

Updated:

Platform:

Replies:

41069 Feb 21,2006 09:51 PM UTC Feb 23,2006 03:15 PM UTC WinForms 2
loading
Tags: GridControl
Kingsley
Asked On February 21, 2006 09:51 PM UTC

How can I change the datasource of a combobox cell when is clicked. I tried the following code without success: private void GDBG_CurrentCellActivated(object sender, System.EventArgs e) { if (GDBG.CurrentCell.ColIndex == 4) { GridComboBoxCellRenderer cr=(GridComboBoxCellRenderer)GDBG.CurrentCell.Renderer; CurrencyManager cm = (CurrencyManager) this.BindingContext[GDBG.DataSource]; DataRow row = (DataRow) ((DataRowView) cm.Current).Row; string ownertype = Convert.ToString(row["Descr"]); string filter = "ContactGroup LIKE ''" + ownertype + "''"; oDS.Tables[2].Rows.Add(oDS.Tables[1].Select(filter)); cr.ListBoxPart.DataSource = oDS.Tables[2]; cr.ListBoxPart.ValueMember = "ContactTypeKey"; cr.ListBoxPart.DisplayMember = "ContactTypeDescription"; }

Administrator [Syncfusion]
Replied On February 22, 2006 06:19 AM UTC

Hi Kingsley, Setting the DataSource for a ComboBox type cell in the CurrentCellActivated event handler works fine. The DataSource can also be set in the CurrentCellShowingDropDown event handler. Please check whether the oDS.Tables[1].Select(filter) in your code returns any row. The DropDown list part wont be shown when the DataSource is empty. Regards, Calvin.

Kingsley
Replied On February 23, 2006 03:15 PM UTC

You''re right, the problem is from the filter line. It''s ok now, Thanks >Hi Kingsley, > >Setting the DataSource for a ComboBox type cell in the CurrentCellActivated event handler works fine. The DataSource can also be set in the CurrentCellShowingDropDown event handler. Please check whether the oDS.Tables[1].Select(filter) in your code returns any row. The DropDown list part wont be shown when the DataSource is empty. > >Regards, >Calvin.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;