Olukayode Oluwole
asked on
How can i ensure that data saved into a database thru a combobox withing a grid displays during retrieval
I have a Grid which i use in my c# application to enter and retrieve data
3 of the columns loaded are from comboboxes within the grid BUT do not show up at retrieval time ( see screen below)
The 3 columns (ItemID , Project and Department ) are properly populated into the Grid columns and i can select from the combo values
But on retrieval the 3 columns do not display the items stored in the database (see below the IteM ID and Description
from the database as shown below.
NOTE that other fields in the Grid which are not loaded from combo boxes show when retrieved
My script for retrieval is the LINQ statement below which works
List<ARSalesDetailModel> variations = GlobalConfig.Connection.Ge tARSalesDe tail();
var data2 = (sender as ListBox).SelectedValue as ARSalesModel;
dgvDetailsTable.DataSource = variations.Where(x => !x.ARSALEDDocumentNo.Equal s(dgvtxtar saleddocum entno.Sele cted) && data2.ARSALEDocumentNo.Equ als(x.ARSA LEDDocumen tNo)).Orde rBy(x => x.ARSALEDID).ToDataTable() ;
and my Load script for the combo for Inventory Items is shown below (This also works as i select from the combo values and safe to the database)
dgvcmbarsaleditemid.DataSo urce = GlobalConfig.Connection.Ge tInventory Items_All( );
dgvcmbarsaleditemid.Displa yMember = "FullInventoryList";
dgvcmbarsaleditemid.ValueM ember = "INVITEMId";
The Combo 3 Boxes load properly , I am able to select from the combo boxes and safe same into the database ( shown)
I have only shown 1 combo box Item ID not showing but it is the same story for the 2 other columns loaded from combos
How can i ensure that data from the database is displayed at retrieval time
Thanks
olukay
3 of the columns loaded are from comboboxes within the grid BUT do not show up at retrieval time ( see screen below)
The 3 columns (ItemID , Project and Department ) are properly populated into the Grid columns and i can select from the combo values
But on retrieval the 3 columns do not display the items stored in the database (see below the IteM ID and Description
from the database as shown below.
NOTE that other fields in the Grid which are not loaded from combo boxes show when retrieved
My script for retrieval is the LINQ statement below which works
List<ARSalesDetailModel> variations = GlobalConfig.Connection.Ge
var data2 = (sender as ListBox).SelectedValue as ARSalesModel;
dgvDetailsTable.DataSource
and my Load script for the combo for Inventory Items is shown below (This also works as i select from the combo values and safe to the database)
dgvcmbarsaleditemid.DataSo
dgvcmbarsaleditemid.Displa
dgvcmbarsaleditemid.ValueM
The Combo 3 Boxes load properly , I am able to select from the combo boxes and safe same into the database ( shown)
I have only shown 1 combo box Item ID not showing but it is the same story for the 2 other columns loaded from combos
How can i ensure that data from the database is displayed at retrieval time
Thanks
olukay
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
Am I right that grid has it's own data source and each of the comboboxes also has it's own datasource?
if yes, then it may be a matter of order when those datasources are refreshed
ziolko.
Am I right that grid has it's own data source and each of the comboboxes also has it's own datasource?
if yes, then it may be a matter of order when those datasources are refreshed
ziolko.
ASKER
Hi ziolko
Thanks for your input.
I have already closd this thread as an earlier siggestion worked
Thanks
Olukay
Thanks for your input.
I have already closd this thread as an earlier siggestion worked
Thanks
Olukay
ASKER
1. Just after LINQ load the DataTable to the Grid
The statement was flagged ( see below )
and it flagged.
I then tried it at the point of Loading the Combo (see below) It was flagged too
It appears dgvcmbarsaleditemid.Select
does not exit
Where am I supposed to use the statement
Thanks
Olukay