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

Combobox in datagrid.

I am trying to use a combobox to display one value but save another using the example in the documentation...


Private Sub Form1_Load(sender As Object, e As System.EventArgs)
Me.gridDataBoundGrid1.DataSource = PrimaryTable
Me.gridDataBoundGrid1.EnableAddNew = False

Dim gbc As GridBoundColumn = Me.gridDataBoundGrid1.Binder.InternalColumns(1)
gbc.StyleInfo.CellType = "ComboBox"
gbc.StyleInfo.DataSource = ForeignKeyTable
gbc.StyleInfo.DisplayMember = "Name"
gbc.StyleInfo.ValueMember = "CustID"
gbc.StyleInfo.ShowButtons = GridShowButtons.ShowCurrentRow
gbc.StyleInfo.HorizontalAlignment = GridHorizontalAlignment.Left
End Sub

The combobox works as long as there is a match in against the display member. A problem occurs when the enters text that doesn't match. The column attempts to add the text anyway which causes a problem with the underlying datasource. Unfortunately, the control has it's own error handler so I am unable to deal with the situation. Any suggestions would be most helpful

1 Reply

HA haneefm Syncfusion Team April 26, 2007 07:46 PM UTC

Hi Marc,

Please refer to the KB article on validating the cells in a grid.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=340


Let me know if this helps.

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon