protected void btnAgregar_Click(object sender, EventArgs e) { try { if (ValidarTamanio() == true) { NegocioCategoria Negocio = new NegocioCategoria(); var NuevaCategoria = Convert.ToString(txtCategoria.Text); Negocio.AgregarCategoria(NuevaCategoria); Response.Redirect("ABMLCategoria.aspx"); } else { string script = @"<script type='text/javascript'> alert('Error campos vacios.'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false); } } catch (Exception ex) { throw ex; } }