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.
Unfortunately, activation email could not send to your email. Please try again.

Want to Control ComboDropDown.Text myself

Thread ID:

Created:

Updated:

Platform:

Replies:

13798 May 11,2004 08:00 AM May 18,2004 05:57 AM Windows Forms 9
loading
Tags: Tools
Administrator [Syncfusion]
Asked On May 11, 2004 08:00 AM

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

Administrator [Syncfusion]
Replied On May 11, 2004 05:04 PM

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.

Administrator [Syncfusion]
Replied On May 12, 2004 01:08 AM

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

Administrator [Syncfusion]
Replied On May 12, 2004 06:02 PM

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.

Administrator [Syncfusion]
Replied On May 13, 2004 01:27 AM

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

Administrator [Syncfusion]
Replied On May 13, 2004 06:06 AM

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.

Sean Greer
Replied On May 17, 2004 04:25 PM

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; } } }

Administrator [Syncfusion]
Replied On May 17, 2004 05:57 PM

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.

Administrator [Syncfusion]
Replied On May 18, 2004 03:33 AM

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

Administrator [Syncfusion]
Replied On May 18, 2004 05:57 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;