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

Want to Control ComboDropDown.Text myself

Hello! When I hide the popup control within a ComboDropDown using PopupContainer.HidePopup(PopupCloseType.Done), Text property seems to be set by the control. I want to set it my self, otherwise the SelectionChangeCommitted event fires twice. Any one? /JE

9 Replies

AD Administrator Syncfusion Team May 11, 2004 09:04 PM UTC

Hi JE, I am afraid, I am unable to understand your requirements correctly. I have attached a sample here that has a ComboDropDown with its PopupControl set to a ListBox. Please modify this sample to show the problem that you are facing. Also let me know the version of Essential Suite that you are using. We appreciate your cooperation, and thanks for choosing Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.


AD Administrator Syncfusion Team May 12, 2004 05:08 AM UTC

Sorry for the inconvenience. I''ll try to explain my self using code aswell. I''m using Essential Tools v 2.0.3.0. Like in your example, I got a Combo with a Listbox. But, unlike your example I''m using an event from the Listbox (SelectedIndexChanged). The event handler controls the hiding of the Listbox and update of the Combo''s Text property. -- Code ... Syncfusion.Windows.Forms.Tools.ComboDropDown cmbDate; ListBox lstDates; ... this.lstDates.SelectedIndexChanged += new EventHandler(OnSelectedIndexChanged); ... private void OnSelectedIndexChanged(object sender, EventArgs e) { cmbDate.Text = DoSomethingWithSelectedListBoxValue(); cmbDate.PopupContainer.HidePopup(PopupCloseType.Done); } The handler, as you can see, sets the combo text property and hides the popup control (i.e. Listbox). Problem: The combo''s SelectionChangeCommitted event fires twice, because something internal updates the combo''s text property as well as I do. I want to update is myself with special treatment. Regards, JE


AD Administrator Syncfusion Team May 12, 2004 10:02 PM UTC

Hi JE, Thanks for the detailed update. I understand your requirements better now. I have modified my code accordingly and have attached_it_here. This code works fine, and the ListBox''s SelectedIndexChanged event gets fired only once and not twice as in your case. I am using Essential Suite v2.0.5.1 for this purpose. Please upgrade to the same and test this sample. Let me know if you need further assistance. We appreciate your continued interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.


AD Administrator Syncfusion Team May 13, 2004 05:27 AM UTC

Hi Guru, My problem remains. Let me modify your code and explain the question again. I added this line to the c''tor: comboDropDown1.SelectionChangeCommitted += new EventHandler(comboDropDown1_SelectionChangeCommitted); And this handler to the class: private void comboDropDown1_SelectionChangeCommitted(object sender, EventArgs e) { MessageBox.Show("Test"); } It results in 2 events and that''s my issue. How can set the Text property without this behavior? Regards, JE


AD Administrator Syncfusion Team May 13, 2004 10:06 AM UTC

Hi JE, Thanks for the update. My apologies for having not understood your requirements correctly earlier. I do see the problem now. The ComboDropDown fires the SelectionChangeCommitted twice when the ComboDropDown''s Text is set in the ListBox''s SelectedIndexChanged event. I have reported this issue to the development team, and will update you on this as soon as I hear from them. We appreciate your feedback, and thanks for choosing Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.


SG Sean Greer May 17, 2004 08:25 PM UTC

Given that the Text property of the ComboDropDown class is virtual, you should be able to derive your own class, override Text and push the value manually into the contained TextBox. Something like this: public class MyComboDropDown : ComboDropDown { public override string Text { get{ return base.Text; } set{ this.TextBox.Text = value; } } }


AD Administrator Syncfusion Team May 17, 2004 09:57 PM UTC

Hi, Thanks for the above answer Sean. Another way of doing this is to override ComboDropDown.GetPopupText and return the preferred value. You could also override SetPopupText if necessary. Let me know if you need any other information. Regards, Guru Patwal Syncfusion, Inc.


AD Administrator Syncfusion Team May 18, 2004 07:33 AM UTC

Hi Guru, Overriding the Text property did the trick. Thanks for excellent support. Cheers, Jonas


AD Administrator Syncfusion Team May 18, 2004 09:57 AM UTC

Hi Jonas, Thanks for the update. Please let us know if you need any other information. Regards, Guru Patwal Syncfusion, Inc.

Loader.
Live Chat Icon For mobile
Up arrow icon