Hello,
I have an Ultrawingrid and couple of coulmns in the windgrid display a UltraDrop down when clicked on it. Now once the drop down displays, I would like to set a couple of columns on the UltraGrid when the user choses a a row in the UltraDropdown.
To make this work I have the follwoing code in the constructor
cmbItems.RowSelected +=
new RowSelectedEventHandler(cmbItems_RowSelected);
And in the method I do the following
private void cmbItems_RowSelected(object sender, Infragistics.Win.UltraWinGrid.RowSelectedEventArgs e) { if (cmbItems.SelectedRow != null) { OrderRepositoryRequest ORR = (OrderRepositoryRequest)dgItems.ActiveRow.ListObject; Item item = (Item)e.Row.ListObject; if (item != null && item.ItemCode.ToString() != ORR.ItemCode) { dgItems.ActiveRow.Cells["ItemCode"].Value = item.ItemCode; dgItems.ActiveRow.Cells["ItemName"].Value = item.Name; dgItems.ActiveRow.Cells["Vintage"].Value = item.Vintage; dgItems.ActiveRow.Cells["UnitPerCase"].Value = item.UnitsCase; } } }
this even is supposed to fire when the user selects a row from the Dropdown list that gets displayed. But for whatever reason this method seems to be firing as soon as I click on the column in the Grid to display the drop down.
Any help would be greatly appreaciated !
THanks,Ashwin
Hello Ashwin,
You should set the 'SelectedRow' to null in the constructor, like this:
cmbItems.SelectedRow = null;
Please take a look at my sample, I will be waiting for your feedback.
Hello Boris,
Thanks for the reply. But that dosent seem to be working. The cmbItems_RowSelected fires as soon as I try to open a drop down from the Ultrigird column. I noticed that this is very random. Some times it fires as soon as i click the dropdown, sometimes it dosent. When it dosent, it fires twice when I select an item in the drop down, but the item i select in the drop down is not the one I choose, but its the same item thats already displayed in that coulmn in the Ultragrid , when the ultra grid loads.
In The follwoing method
private void BindItemsDropDown() { this.cmbItems.SetDataBinding(_presenter.GetItems(), null); this.cmbItems.ValueMember = "ItemCode"; this.cmbItems.DisplayMember = "ItemCode"; }
as you can see i have ItemCode set to both the properties. And "ItemCode" is also the Key for the column in the ultrgrid to which this dropdown is associated with. COuld this be an issue in anyway ?
Hoping for some help.
Thanks,Ashwin
Hi Boris,
I also noticed that, if i have the displaymember and the value member = "ItemCode", when I click on the dropdown, it fires the row selected event and in the drop down I see the itemcode which was originally bound to the Ultragrid when it was loaded is highlited in the Dropdown, but when I select any other row, it does not highlight the row I select, but it closes the dropdown, but the rowselected event is fired , but the object I get from
Item item = (Item)e.Row.ListObject;
Is the same same object, that was originally bound to the Ultragrid.
Its behaving pretty wierd is all I can say ... and I am not sure where I am going wrong.
There must be something else going on here. I tried this in a blank new project and did not observe any weird behaviors like this. Could you please share a small sample project which reproduces these behaviors with your scenario. I will be happy to take a look at it.
I am checking about the progress of this issue. Please let me know If you need any further assistance on this.