I have a problem with following code:
protected override void OnLoad(EventArgs e) { base.OnLoad(e); // -> DataTable dt = new DataTable("dt"); dt.Columns.Add("id", typeof(int)); dt.Columns.Add("name", typeof(string)); dt.Rows.Add(new object[] { 0, "000" }); dt.Rows.Add(new object[] { 1, "111" }); ultraCombo1.DataSource = dt; ultraCombo1.ValueMember = "id"; ultraCombo1.DisplayMember = "name"; ultraCombo1.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.None; ultraCombo1.RowSelected += new Infragistics.Win.UltraWinGrid.RowSelectedEventHandler(ultraCombo1_RowSelected); } void ultraCombo1_RowSelected(object sender, Infragistics.Win.UltraWinGrid.RowSelectedEventArgs e) { // Event is Fired! }
Then when i type "11" in UltraCombo control - second row selected and event RowSelected fired!
How to prevent this behavior?
Hi,
I tried this out and the event fires twice. It fires once to select the second row (text: "111") and then again with the row as null.
I think these events are correct, but they are a little weird. What happens is.. when you type in a "1", the first row gets selected because the "1" matches the value of the DataMember. Then when you type "11", there is no match, and so the event fires again with a null row.
Why the first event doesn't fire until after you press the second character is a mystery and may be a bug.So I'm going to forward this to Infragistics Developer Support and have it looked into.
Thanks for reply Mike
now i little modify my code:
protected override void OnLoad(EventArgs e) { base.OnLoad(e); // -> DataTable dt = new DataTable("dt"); dt.Columns.Add("id", typeof(int)); dt.Columns.Add("name", typeof(string)); dt.Rows.Add(new object[] { 0, "sfd" }); dt.Rows.Add(new object[] { 1, "abc" }); ultraCombo1.DataSource = dt; ultraCombo1.ValueMember = "id"; ultraCombo1.DisplayMember = "name"; ultraCombo1.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.None; ultraCombo1.RowSelected += new Infragistics.Win.UltraWinGrid.RowSelectedEventHandler(ultraCombo1_RowSelected); } void ultraCombo1_RowSelected(object sender, Infragistics.Win.UltraWinGrid.RowSelectedEventArgs e) { // Event is Fired! }
when i type "abc" RowSelected also fired.
Now is any way to avoid row auto select by typing value that equal to display member or value member? May be i should use reflection or override some protected method?
How to prevent row selecting when you type text like ValueMember or DisplayMember?
Please help
Hi worner,
I am facing the same situation my self. If you have a combo with a valuemember = 1 and a displaymember = "Money", when you type "1" into the combo Money is selected and this is not the way i want it to work. I only want the combo to select the Displaymembers when i type in the combo.
What i did to get around this was to set the displaymember as the valuemember .i.e., it has both roles. So now when i type "1" in the combo "Money" does NOT come up.
What is means how eva is that if u want the ID of the selected row you can't just say Combo.value, you have to say Combo.SelectedRow.Cell[0].value.
it's a work around, but it seems to work. Hopefully the infragistics team will be able to give us a better solution
There's no way to stop the event from firing in just that case.