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

ComboBoxAdv problem...

I can''t believe this hasn''t been addressed before. Assume following situation: screen with a comboboxadv on it. following binding: DataTable dt = this.ds_new.Tables[0]; dt.Constraints.Clear() foreach (DataColumn dc in dt.Columns) { dc.AllowDBNull = true; } //add an empty row to the datatable //because we need to be able to blank out //the combobox DataRow dr = dt.NewRow(); dt.Rows.Add(dr); this.cmbAdv.DataSource = dt; this.cmbAdv.DisplayMember = "CODE"; this.cmbAdv.ValueMember = "CODE"; this.cmbAdv.DataBindings.Clear(); this.cmbAdv.DataBindings("SelectedValue", this.ds_other.Tables[0], "OTHERCODE"); Whenever I''m blanking out the value in the combobox in my screen and then I save my values to the DB, the combobox first defaults to the first entry in the list and saves that value to my ds_other.Tables[0]... what do I have to do to be able to save "" or null values? setting this.cmbAdv.TextBox.Text to "" or null does not help, neither does setting .Text, .SelectedIndex to -1 or whatever... any help would be greatly appreciated!

3 Replies

AR Anupama Roy Syncfusion Team March 20, 2006 01:56 PM UTC

Hi Filip, Sorry for the delay in response.I am looking into this and will get back to you soon. Regards, Anu.


AD Administrator Syncfusion Team March 30, 2006 08:14 AM UTC

Thank you! I hope you will find a solution :)


AR Anupama Roy Syncfusion Team March 31, 2006 02:00 PM UTC

Hi Filip, Sorry for the delay in response. The intended behavior of the DropDownList DropDownStyle of ComboBoxAdv is to ensure that the Text property will always be one of the entries in the Items list.And this is how the .NET ComboBox control behaves too. Our ComboBox controls are closely modelled on the .NET ComboBox and we have maintained similar behavior for consistency purposes. I am really sorry to inform you that I am unable to provide you a workaround also.One thing you can do is ,if you do not have cross connectivity with fields,before loading the items from your database,you can try to check for the duplicate values.I am not very sure how your scenario would match with this. We regret very much for the inconvienience caused. Regards, Anu.

Loader.
Live Chat Icon For mobile
Up arrow icon