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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Master/Slave ComboBox - Strange Behavior

Thread ID:

Created:

Updated:

Platform:

Replies:

61756 May 31,2007 10:45 PM UTC Jun 6,2007 11:29 PM UTC Windows Forms 3
loading
Tags: GridControl
Adi
Asked On May 31, 2007 10:45 PM UTC

Hi,

I have implemented two ComboBox cells in my datagrid as suggested in the documentation. The master combo is populated from DataTable with string type for display and integer type for value. Once selected the integer value is set as a value of the datagrid cell while string is displayed.

Once the slave combo in the same row is dropped the integer value from the master is used to query SQL database and populate DataTable with an integer and a date converted to string column. The DataTable is bound to the slave combo using code below and that seems to work.

The issue is that once the slave combo is dropped down and a value selected datagrid displays the integer (i.e. the value column) and not a date (i.e. the display column).

Has anybody experienced this issue and if so what could be the remedy? Thanks

private void dg_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
{


GridCurrentCell cc= dg.CurrentCell;

if (cc.ColIndex == 2)
{
//get DataTable from SQL here
DataTable dt = ...

GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer;

cr.ListBoxPart.DataSource = dt;


}

}

haneefm [Syncfusion]
Replied On June 1, 2007 05:38 PM UTC

Hi Adi,

In your slave combox column, you can set the style.DisplayMember to be the name of the column in the slave table that you want to see displayed in the grid, and set style.ValueMember to be the name of the column in the slave table that has values that match the values originally displayed in the grid column.

[c#]
this.gridDataBoundGrid1.DataSource = ds.Tables["Orders"]; //Primary key table.
this.gridDataBoundGrid1.Binder.InternalColumns["EmployeeID"].StyleInfo.DataSource = ds.Tables["Employees"]; //Slave key table.
this.gridDataBoundGrid1.Binder.InternalColumns["EmployeeID"].StyleInfo.DisplayMember = "FirstName"; //display the name in a primary key table for Slave key column.
this.gridDataBoundGrid1.Binder.InternalColumns["EmployeeID"].StyleInfo.ValueMember = "EmployeeID"; //slave key column name in a primary key table.
this.gridDataBoundGrid1.Binder.InternalColumns["EmployeeID"].StyleInfo.CellType = "ComboBox"; //Make it as a comobo box cell.

Sample : http://websamples.syncfusion.com/samples/Grid.Windows/DataBoundForiegnKey_180c4462/main.htm

Best regards,
Haneef

Adi
Replied On June 6, 2007 04:08 PM UTC

Hi,

I regret to say that the code provided did not work. For some reason when the value is slected in a dropdown the displayed text in the grid reverts to an integer value instead of remaining a date. Any other ideas?

haneefm [Syncfusion]
Replied On June 6, 2007 11:29 PM UTC

Hi Adi,

Thank you for your update.

I am really sorry to inform you that I am not able to reproduce the issue in Essential version V4.4 with VS.Net 1.1/2.0. Maybe I am not following the steps that you are doing. Is it possible for you to upload us a minimal sample to reproduce the issue here? This will help us to analyse the issue further.

Best regards,
Haneef

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

;