Hi,
I have an ultracombo control that gets filled by a dataset. If I do not choose anything and press the save button the value of the combo equals 'default' and the SQL stored procedure gives an error as 'default' is passed instead of null.
How can I send a null value if nothing is selected?
Thanks.
Hi Mike,
I tried using the DataSourceNullValue. That works when I delete all the text in the comboeditor. However if I select a valid item, go to another control then back to the comboeditor and type in an invalid value and tab out, the value of the comboeditor does not change. The text of the comboeditor however still shows the invalid value. Is there a property I can set to that the text shows for the value selected instead of the invalid one? Thanks
Hi Nicolas,
This can't be all of it... you started off this post saying that you are binding the Value property of the combo, didn't you? There's nothing here that does that. You are only binding the list portion of the combo here. That just populates the list. There is nothing here that even refers to the combo's Value.
cmbSurgeons.DataSource = ds.Tables[0];cmbSurgeons.ValueMember = "surgeonID";cmbSurgeons.DisplayMember = "Surgeon Name";cmbSurgeons.DisplayLayout.Bands[0].Columns[0].Hidden = true;cmbSurgeons.DisplayLayout.Bands[0].Columns[1].Width = 200;
The code you have here is populating the list. You must also be binding the Value using DataBindings.Add, right? This returns a Binding object.
How can I do that?
DataSet ds = new DataSet();SqlDataAdapter da = new SqlDataAdapter(comm);da.Fill(ds);cmbSurgeons.DataSource = ds.Tables[0];