protected void btnCargarSecretaria_Click(object sender, EventArgs e) { try { Secretaria oSecretaria = new Secretaria(); oSecretaria.Nombre = txtNombreSecretaria.Text; oSecretaria.Secretario = txtSecretario.Text; oSecretaria.Juzgado = Convert.ToInt32(lblJuzgadoId.Text); Controller.guardarSecretaria(oSecretaria, "Insert"); lblError.Visible = true; lblError.ForeColor = Color.Green; lblError.Text = "Los Datos De La Secretaría Se Cargaron Exitosamente"; GridViewSecretarias.DataBind(); } catch (Exception) { lblError.Visible = true; lblError.ForeColor = Color.Red; lblError.Text = "Ocurrio Un Error Al Cargar Los Datos De La Secretaria"; } }
protected void GridViewJuzgados_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewSecretarias.DataSourceID = "ObjectDataSourceSecretarias"; GridViewSecretarias.DataBind(); CleanJuzgados(); EnableJuzgados(false); EnableSecretarias(true); if (e.CommandName == "Select") { int rowIndex = int.Parse(e.CommandArgument.ToString()); lblJuzgadoId.Text = GridViewJuzgados.Rows[rowIndex].Cells[2].Text; txtNombreJuzgado.Text = HttpUtility.HtmlDecode(GridViewJuzgados.Rows[rowIndex].Cells[3].Text); txtJuez.Text = GridViewJuzgados.Rows[rowIndex].Cells[4].Text; txtDireccion.Text = GridViewJuzgados.Rows[rowIndex].Cells[5].Text; txtTelefono.Text = GridViewJuzgados.Rows[rowIndex].Cells[6].Text; GridViewSecretarias.DataBind(); } }