protected void btnRegistrar_Click(object sender, EventArgs e) { if (Page.IsValid) { var menuElegido = ddlMenues.SelectedItem; var bebidaElegida = ddlBebidas.SelectedItem; var postreElegido = ddlPostres.SelectedItem; int id = int.Parse(hideID.Value); PedidoServicio.PedidoFormulario pedidoForm = new PedidoServicio.PedidoFormulario(); pedidoForm.id = id; pedidoForm.fecha = txtFecha.Text; pedidoForm.cliente = txtCliente.Text; pedidoForm.menu = menuElegido.Text; pedidoForm.menuPrecio = txtPrecioMenu.Text; pedidoForm.bebida = bebidaElegida.Text; pedidoForm.bebidaprecio = txtPrecioBebida.Text; pedidoForm.postre = postreElegido.Text; pedidoForm.postreprecio = txtPrecioPostre.Text; pedidoForm.formapago = rdFormaPago.SelectedValue; var accion = PedidoServicio.Actualizar(pedidoForm); if (accion) { //sets the message and the type of alert, than displays the message labelMessage.Text = "El pedido se ha actualizado correctamente"; Message.CssClass = string.Format("alert alert-{0} alert-dismissable", "success"); Message.Attributes.Add("role", "alert"); Message.Visible = true; LimpiarFormulario(); if (id > 0) { Page.Response.Redirect(Page.Request.Url.ToString(), true); } } else { labelMessage.Text = "Ha ocurrido un error al intentar actualizar el pedido"; Message.CssClass = string.Format("alert alert-{0} alert-dismissable", "danger"); Message.Attributes.Add("role", "alert"); Message.Visible = true; } } }