protected void GuardarBtn_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(Descripcion_Txt.Text.Trim())) { //Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Hay campos vacios')", true); ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Hay compas invalidos');", true); return; } Modulo obj = new Modulo(); obj.AreaId = Convert.ToInt32(Area_Cbx.SelectedValue); obj.Descripcion = Descripcion_Txt.Text.Trim(); if (string.IsNullOrEmpty(Id_Txt.Text)) { ModuloBLL.InsertModulo(obj); } else { obj.ModuloId = Convert.ToInt32(Id_Txt.Text); ModuloBLL.UpdateModulo(obj); } Response.Redirect("ListaModulos.aspx"); } catch (Exception ex) { //Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Error en la operacion')", true); ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Error en la operacion');", true); throw ex; } }