Avatar of Olukayode Oluwole
Olukayode Oluwole
Flag for Canada

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)

Grid Data  showing  ItemID Column Not showing in the Grid
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.

Inventory Item Table in database showing ItemID Column and Description
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.GetARSalesDetail();
         var data2 = (sender as ListBox).SelectedValue as ARSalesModel;
         dgvDetailsTable.DataSource = variations.Where(x => !x.ARSALEDDocumentNo.Equals(dgvtxtarsaleddocumentno.Selected) && data2.ARSALEDocumentNo.Equals(x.ARSALEDDocumentNo)).OrderBy(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.DataSource = GlobalConfig.Connection.GetInventoryItems_All();
 dgvcmbarsaleditemid.DisplayMember = "FullInventoryList";
 dgvcmbarsaleditemid.ValueMember = "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


C#* combobox

Avatar of undefined
Last Comment
Olukayode Oluwole

8/22/2022 - Mon