protected void btnSave_Click(object sender, EventArgs e) { try { string name = txtName.Text; string type = ddType.SelectedValue; double price = Convert.ToDouble(txtPrice.Text); string image = ddImage.SelectedValue; string description = txtDescription.Text; double weight; if (txtWeight.Text.Equals("")) { weight = 0; } else { weight = Convert.ToDouble(txtWeight.Text); } string dimensions = txtDimensions.Text; string ingredients = txtDimensions.Text; string holiday = ddHoliday.SelectedValue; Chocolate chocolate = new Chocolate(name, type, price, image, description, weight, dimensions, ingredients, holiday); ConnectionClass.AddChocolate(chocolate); lblResult.Text = "Upload succesful!"; ClearTextFields(); } catch (Exception) { lblResult.Text = "Upload failed!"; } }