protected void LoadFreightData(Freight frg) { RadioButtonListBuyOrSell.SelectedIndex = frg.FreightDirection == "To customer" ? 1 : 0; RadioButtonListBuyOrSell_SelectedIndexChanged(null, null); CalendarWithTimeControlDateTime1.SelectedDateTime = frg.FreightDateTime; TextBoxTotalNetWeight.Text = frg.TotalNetWeight.ToString(); TextBoxPMV.Text = frg.FirstFreightWeighingDescription(); TextBoxCustomerPlate.Text = frg.YourTruckPlate; TextBoxCustomerID.Text = frg.YourDriverName; ComboBoxWeighingLocation.DataBind(); ListItem li = ComboBoxWeighingLocation.Items.FindByValue(frg.SourceOrDestinationLocation.Id.ToString()); if (li != null) { li.Selected = true; } ComboBoxCustomer.DataBind(); li = ComboBoxCustomer.Items.FindByValue(frg.FromRelation.Id.ToString()); if (li != null) { li.Selected = true; } ComboBoxOurPlate.DataBind(); if (frg.OurTruck != null) { li = ComboBoxOurPlate.Items.FindByValue(frg.OurTruck.Id.ToString()); if (li != null) { li.Selected = true; } } //ComboBoxWeighingLocation = ControlObjectContext.GetObjectByKey(new EntityKey("ModelTMSContainer.LocationSet", "Id", frg.SourceOrDestinationLocation )) as Location; //ComboBoxCustomer = ControlObjectContext.GetObjectByKey(new EntityKey("ModelTMSContainer.RelationSet", "Id", frg.FromRelation.Id)) as Relation; //ComboBoxOurPlate = ControlObjectContext.GetObjectByKey(new EntityKey("ModelTMSContainer.TruckSet", "Id", frg.OurTruck.Id)) as Truck; }