Exemplo n.º 1
0
        private void BindVehicle()
        {
            try
            {
                Vehicle vehicle = Vehicle.GetVehicleByVehicleId(this.vehicleId);
                TextBoxType.Text  = vehicle.Type;
                TextBoxModel.Text = vehicle.Model;
                TextBoxVehicleRegistration.Text = vehicle.Registration;
                TextBoxVINNumber.Text           = vehicle.VINNumber;
                TextBoxTrackerReference.Text    = vehicle.TrackerReference;
                TextBoxComment.Text             = vehicle.Comment;

                DropDownListVehicleOwnership.ClearSelection();
                DropDownListVehicleOwnership.Items.FindByValue(vehicle.VehicleOwnershipId.ToString()).Selected = true;

                DropDownListVehicleInsuranceBand.ClearSelection();
                DropDownListVehicleInsuranceBand.Items.FindByValue(vehicle.VehicleInsuranceBandId.ToString()).Selected = true;
            }
            catch (System.Data.SqlClient.SqlException sqlEx)
            {
                for (int i = 0; i < sqlEx.Errors.Count; i++)
                {
                    LabelError.Text += (sqlEx.Errors[i].Message + "<br />");
                }
                PanelError.Visible = true;
            }
            catch (Exception exception)
            {
                LabelError.Text   += (exception.Message + "<br />");
                PanelError.Visible = true;
            }
        }
Exemplo n.º 2
0
 private void BindVehicleOwnership()
 {
     DropDownListVehicleOwnership.ClearSelection();
     DropDownListVehicleOwnership.DataSource     = VehicleOwnership.GetVehicleOwnershipList();
     DropDownListVehicleOwnership.DataTextField  = "Description";
     DropDownListVehicleOwnership.DataValueField = "VehicleOwnershipId";
     DropDownListVehicleOwnership.DataBind();
     DropDownListVehicleOwnership.Items.Insert(0, new ListItem("Please select", "0"));
 }