are there is event like SelectionChangeCommitted in the rad ComboBox in win forms ?
the pwoer of this event is that SelectionChangeCommitted is raised only when the user changes the combo box selection. if you use SelectedIndexChanged or SelectedValueChanged to capture user changes, because those events are also raised when the selection changes programmatically.
9 Answers, 1 is accepted
Thank you for contacting us.
Unfortunately we do not have such a property, but what you can do here is subscribe for the DropDownOpened event, and then in it subscribe for the SelectedIndexChanged event and this is how you can access "changing by user" event:
public Form1() { InitializeComponent(); this.radComboBox1.DropDownOpened +=new EventHandler(radComboBox1_DropDownOpened); } bool subscribed = false; private void radComboBox1_DropDownOpened(object sender, EventArgs e) { if (!subscribed) { this.radComboBox1.SelectedIndexChanged += new EventHandler(radComboBox1_SelectedIndexChanged); subscribed = true; } } void radComboBox1_SelectedIndexChanged(object sender, EventArgs e) { this.Text = "My Text"; } I hope this helps. If you have any other questions, do not hesitate to contact us.
Stefan
the Telerik team
We removed RadComboBox control from our suite and now it is replaced with the RadDropDownList control. We decided that the described functionality is a very specific scenario which can be implemented with custom code and it should not be included in RadDropDownList implementation. I am posting here an updated version of the solution offered by my colleague:
bool clicked = false;void list_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e){ if (clicked) { Console.WriteLine("Selected by User: " + e.Position); clicked = false; } else { Console.WriteLine("Selected programmatically: " + e.Position); }}void list_PopupClosed(object sender, RadPopupClosedEventArgs args){ clicked = args.CloseReason == RadPopupCloseReason.Mouse;}I hope it helps.
Kind regards,
Jack
the Telerik team
Hi Jack,
Despite this is an old subject/post, I am trying to implement your solution, but, what if I need both previous and new values?
I remember there was something like:
e.OldIndex and e.NewIndex
But now I can't find them withing PositionChangedEventArgs.
Any clue? (I would not like to use a variable to explicitly get index every time it changes)
Thanks in advanced.
Francisco
If you do not want to use a variable, then you can use the SelectedIndexChanging event. At the time it triggers, the control will hold the old SelectedIndex, and the event will provide the new one:
void radDropDownList1_SelectedIndexChanging(object sender, Telerik.WinControls.UI.Data.PositionChangingCancelEventArgs e) { int oldIndex = radDropDownList1.SelectedIndex; int newIndex = e.Position; }I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.
Regards,
Stefan
Telerik
Thanks very much Stefan, it works as expected.
One more question, I am dynamically adding this RadDropDownList, and I need to pre select some default item.
I am trying with:
DataView dv = dt.DefaultView;
dv.RowFilter = "City = 'NYC'";
RadDropDownList ddl = new RadDropDownList();ddl.Name = "ddl":ddl.DataSource = dv;ddl.DisplayMember = "Name";ddl.ValueMember = "Id";RadListDataItem li = ddl.FindItemExact(SomeId, false);if (li != null){ li.Selected = true;}But it seems that after line ddl.DataSource = dv items count is always 0 even when dv has items.
I am sorry for take advantage of this post.
Thanks in advance,
fco
Complementing previous post:
In fact, after WinForm finish loading, The dropdown (ddl) has items, but none item is selected.
Thanks,
fco
If you execute this code in the form's constructor, the item will not be selected indeed, however, if you move it to Form.Load or a later event, the item will be correctly selected.
I hope this helps.
PS. Indeed, it is better to keep just one topic per thread so the forums are easy to navigate. We will appreciate it if you separate the unrelated questions in separate threads. Thanks.
Regards,
Stefan
Telerik

hi,
any one sugeest suppose muticombo box suppose binded data i am trying to remove that time conditionaly not remove
Hello, Ganesh,
According to the provided information, it is difficult to me to understand what is the exact requirement that you are trying to achieve. Could you please elaborate? Once we get better understanding of the precise case, we would be able to think about an appropriate solution and provide further assistance.