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