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.

Issue with SelectedIndexChanging event

Thread ID:

Created:

Updated:

Platform:

Replies:

77603 Nov 9,2008 04:08 AM Aug 19,2010 07:38 AM Windows Forms 7
loading
Tags: Tools
Hoang Cuong
Asked On November 9, 2008 04:08 AM

I am using ES 6.4.0.15 and ComboBoxAdv controls in my app. When user change the selected item in ComboBoxAdv the app will display a MessageBox to ask user saving changed data. I handled the SelectedIndexChanging event to perform this task. I found a strange issue with SelectedIndexChanging.

+ If in the handled method there are MessageBox calls then when user selects item BY MOUSE the selected item will not be changed although e.Cancel = false

+ If in the handled method there is not MessageBox calls or user selects item BY KEYBOARD everything is OK.



Fathima Shalini P [Syncfusion]
Replied On November 11, 2008 05:22 AM

Hi Cuong,

Thank you for your interest in Syncfusion Products.

I have tested the issue with the simple sample in which a messagebox appears asking whether we need to change the selected item or not. If we click 'ok', the item is selected if we click 'cancel' the previously selected item is selected. I am afraid that I was not able to reproduce the issue.

http://websamples.syncfusion.com/samples/Tools.Windows/F77603/main.htm

Please refer to the above sample, if I am missing anything could you please modifiy the above sample and send me so that I could work out in depth and provide you a better solution?

Please let me know if any concerns.

Regards,
Fathima


Hoang Cuong
Replied On November 11, 2008 07:16 PM

Hi,

In your given sample the issue does not occur because the ComboBoxAdx.DropDownStyle = ComboBoxStyle.DropDown. If you change ComboBoxAdx.DropDownStyle = ComboBoxStyle.DropDownList, the issue will occurs.

I also made a slight change in the sample (Form1.cs).



Fathima Shalini P [Syncfusion]
Replied On November 13, 2008 12:08 AM

Hi Cuong,

Thank you for your update.

Setting e.Cancel to false in SelectedIndexChanging event does not change the selected value

We suspect this issue could be a defect. We have forwarded this to our developers for more analysis. We will update you on or before November 17th 2008.

Please let me know if any concerns.

Regards,
Fathima


Alex Feldman
Replied On August 17, 2010 06:40 PM

Hi,

I'm having the same issue in v.8.203.0.18.
(I checked the first case mentioned.)

Is there workaround for this problem?

Lingaraj S [Syncfusion]
Replied On August 18, 2010 07:05 AM

Hi Alex,

Regret for the inconvenience.

Please try using below way to achieve your requirement in ComboBoxAdv as shown below.

private void Form1_Load(object sender, EventArgs e)
{
this.comboBoxAdv1.SelectedIndexChanging += new Syncfusion.Windows.Forms.Tools.SelectedIndexChangingHandler(comboBoxAdv1_SelectedIndexChanging);
this.comboBoxAdv1.PopupContainer.BeforeCloseUp += new CancelEventHandler(PopupContainer_BeforeCloseUp);
}
void PopupContainer_BeforeCloseUp(object sender, CancelEventArgs e)
{
if (show)
{
e.Cancel = true;
}
}
bool show = false;
void comboBoxAdv1_SelectedIndexChanging(object sender, Syncfusion.Windows.Forms.Tools.SelectedIndexChangingArgs e)
{
if(this.comboBoxAdv1.DropDownStyle==ComboBoxStyle.DropDownList)
show=true;
if (MessageBox.Show("Want to change?", "Change Value", MessageBoxButtons.OKCancel) != DialogResult.OK)
{
show = false;
this.comboBoxAdv1.PopupContainer.HidePopup(Syncfusion.Windows.Forms.PopupCloseType.Canceled);
}
else
{
show = false;
this.comboBoxAdv1.PopupContainer.HidePopup(Syncfusion.Windows.Forms.PopupCloseType.Done);
}
}


Refer the sample from following link.
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=ComboTest-1865428379.zip

Please let me know if you have any queries.

Regards,
Lingaraj S.

Alex Feldman
Replied On August 18, 2010 08:30 AM

Thank you!!! First test indicated that workaround works.

Lingaraj S [Syncfusion]
Replied On August 19, 2010 07:38 AM

Hi Alex,

Thank you for the update and your contribution in Syncfusion Community Forums.

Please let me know if you have any queries.

Regards,
Lingaraj S.

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.

;