Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Good Day!

Anyone can help me this combo box problem.
I have a combox box that bound a collection objects.
C#
bdsItemCode.DataSource = SalesCostItem.GetSalesCostItemByCustVendTypeBranchAndSystemJob(objCurrentCustomerDTO.CustVendTypeCode, objTruckInvoice.BranchCode, objCurrentSpecialJobDetail.systemJobRelation);
cboItemCode.DataSource = bdsItemCode;
cboItemCode.DisplayMember = "SalesCostItemCode";


My problem is some items will be missing or hiden from dropdownlist after selectionIndexchange. First load the combo box item looks complete, but after several item seletions some item from dropdown list are missing.

Is any idea to solved this problem is highly appreciated.



Thank you very much.
Posted
Comments
SwaxRak 15-Sep-11 3:06am    
Are you adding all Items (through Datasource) during every selectionIndexchange?
Gerry Logrosa 15-Sep-11 3:39am    
No, I loaded all the items(List<classobject>) during form load.
Gerry Logrosa 15-Sep-11 3:52am    
during loading all items were loaded properly. The problem occur during selection changed. First I select item[0], then second select another item, third selection I observed that the item[0] is missing from the dropdownlist.
KenBonny 15-Sep-11 3:17am    
This is where you databind the list items to the combobox, probably done in the constructor or when the form loads. Could you post the on selection changed function too, because I can't divine what happens from this example.
Gerry Logrosa 15-Sep-11 3:44am    
Hi sir KenBonny,here code inside SelectedIndexChanged.

protected virtual void cboItemCode_SelectedIndexChanged(object sender, EventArgs e)

{

objCurrentInvoiceItem.ItemCode = cboItemCode.Text.ToString();

if (parentquotationNo != "")
{

GetJobAndTransportRate(out objTransportRate, out msg, out transportRateUOMList);

} DisplayItemInfo();
}

1 solution

While debugging Check the Count of bdsItemCode and cboItemCode , May be the problem with binding datasource
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900