private void FixUpComboBoxProducts() { try { ComboBoxProduct.DataBind(); } catch { ComboBoxProduct.SelectedIndex = -1; } }
public void LoadFirstWeighingData(Freight frg) { DataBind(); FreightWeighing fgw = frg.FreightWeighing.First <FreightWeighing>(); FreightWeighingMaterial fwm = fgw.FreightWeighingMaterial.First <FreightWeighingMaterial>(); TextBoxOrderNumber.Text = frg.OurReference.ToString(); TextBoxDescription.Text = frg.Description; if (frg.FreightDirection == "To warehouse") { RadioButtonListBuyOrSell.SelectedIndex = 0; } else { RadioButtonListBuyOrSell.SelectedIndex = 1; } SetCustomerType(); ComboBoxWeighingLocation.DataBind(); ListItem li = ComboBoxWeighingLocation.Items.FindByValue(frg.SourceOrDestinationLocation.Id.ToString()); if (li != null) { li.Selected = true; } CalendarWithTimeControlDateTime1.SelectedDateTime = frg.FreightDateTime; TextBoxKey1.Text = fgw.Key1; TextBoxGrossWeight.Text = fgw.Weight1.ToString(); CheckBoxIsDriverInTruck.Checked = fgw.IsDriverInTruck; TextBoxPMV.Text = fgw.Description; ComboBoxOurPlate.DataBind(); if (frg.OurTruck != null) { li = ComboBoxOurPlate.Items.FindByValue(frg.OurTruck.Id.ToString()); if (li != null) { li.Selected = true; ComboBoxOurPlate.SelectedIndex = ComboBoxOurPlate.Items.IndexOf(li); } } TextBoxCustomerPlate.Text = frg.YourTruckPlate; TextBoxCustomerID.Text = frg.YourDriverName; ComboBoxCustomer.DataBind(); li = ComboBoxCustomer.Items.FindByValue(frg.FromRelation.Id.ToString()); if (li != null) { li.Selected = true; } LabelCustomerGuid.Text = frg.FromRelation.Id.ToString(); ComboBoxProduct.DataBind(); li = ComboBoxProduct.Items.FindByValue(fwm.Material.Id.ToString()); if (li != null) { li.Selected = true; } CurrentWeighingId = frg.Id; // make sure the cash ledger of the current location is set SetCorrectLocationCashLedger(); }