The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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 with a match against the "DisplayMember." When there isn't a match, the grid adds the entered text to the foreign key column of the PrimaryTable which is not desired. Is there a property I can check or an event that is raised in the later situation. Also, is there a way to make a combobox both editable and autocomplete at the same time.
ADAdministrator Syncfusion Team February 14, 2007 07:04 PM UTC
The forum you mentioned addresses the autocomplete problem not the other. I will re-emplain.
When the combobox "displaymember" matches the entered text, it adds the corresponding "valuemember" to the corresponding column in the the grid. This is the expected behavior.
When the combobox's "displaymember" does NOT match the entered text, there isn't a "valuemember." The combobox adds the "displaymember" instead but the datasource of the grid is expecting a foreign key. The datasource errors (unless the entered text is a foreign key).
Is their a way to find out before the combobox writes the value to the grids datasource?