Hi, I have a WinGrid based on Table A. I have column AA which is UltraDropDown column with value from Table B. Table B holds all possible values for column AA in Table A. I am modifying Table A and I am adding new value to column AA. I want to add also new record in Table B and refresh UltraDropDown with new value. I can modify Table B easily but I have a problem with UltraDropDown on column AA in Table A. Then I am trying to add new row (to UltreDropDown) like this: UltraGridRow newrow = this.ultraDropDownGrid.DisplayLayout.Bands[0].AddNew() I am getting an error that I UltraDropDown is not supporting ADD functionality. My question is how can I spouse to add new value to UltraDropDown or refresh data with new values ? Regards Piotr
Hi Piotrek,
I'm not very familiar with IQueryable and I don't have a lot of experience with LINQ2SQL, but from what I understand, the data objects that are returned by LINQ2SQLdo not implement IBindingList and therefore do not send notifications to bound controls when things change. So you will have to use the Rows.Refresh method as I suggested above.
If that doesn't work for some reason, then I don't think the problem is with the UltraDropDown, but rather with the data source itself.
Hi Mike,
I am working with IQueryable source as a DataSource (System.Data.Linq.Table) for my UltraDropDown control ( I am using LINQ2SQL to populate data for WinGrid and UltraDropDown).
I am modifying Table B ( and/or Table A ) using DataContext and InsertOnSubmit ( and SubmitChanges ).
I will explain you in a other way step by step ( maybe it will be quicker ):
1. I am adding new record to the Table A ( WinGrid ) and I have decided to add new value for UltraDropDown column ( which not exists in Table B ).
2. I am adding new record to Table A and in the same way adding new value ( record ) to Table B. I am adding new record to WinGrid and in the background WinGrid is adding new row to my DataSource.
UltraGridRow newrow = this.ultraGrid.DisplayLayout.Bands[0].AddNew();
I can not do the same operation for Table B ( adding new row to UltraDropDown ) and I am in my code adding new row with correct data to my DataSource connected to UltraDropDown.
When I am using GetChangeSet() command in my code I can see all newly added rows as we expected but I can not refresh UltreDropDown with new data. That's my problem.
I do not want to call SubmitChanges because I want to offer to the client solution when he will be able to add several rows to the WinGrid and he will be able to select in any other (new/existing) row my new value from UltraDropDown as a possible ( valid ) choice.
Regards
Piotrek
Hi Piotr,
UltraDropDown does not support added new rows through the UI, which is what this line of code is trying to do.
The good news is that you don't have to. If you add a row to Table B and the UltraDropDown is bound to table B, then that row should show up in the DropDown automatically. If it's not showing up, then something it wrong.
One possible reason for this is that Table B does not notify bound controls that a new row has been added. What type is Table B? Is it a DataTable? Or is it some custom collection you created?
Either way, you should be able to force the UltraDropDown to refresh itself easily enough by calling UltraDropDown.Rows.Refresh(ReloadData). Obviously you would call this method immediately after you updated Table B.