protected void btnEditar_Click(object sender, EventArgs e) { try { Limpiar(); LinkButton btn = (LinkButton)sender; GridViewRow row = (GridViewRow)btn.NamingContainer; Label _LblId = (Label)GrvPerfiles.Rows[row.RowIndex].FindControl("LblId"); hfIdPerfil.Value = _LblId.Text; int? IdPerfil = Convert.ToInt32(hfIdPerfil.Value); DataTable dt = new DataTable(); dt = dal.GetBuscarPerfil(IdPerfil).Tables[0]; foreach (DataRow item in dt.Rows) { hfIdPerfil.Value = item["IdPerfil"].ToString(); TxtIdPerfil.Text = hfIdPerfil.Value; TxtNombres.Text = item["Perfil"].ToString(); } MdlAgregar.Show(); } catch (Exception ex) { lblInformacion.Text = ex.Message; mdlInformacion.Show(); } }
protected void BtnNuevo_Click(object sender, EventArgs e) { try { Limpiar(); hfIdPerfil.Value = "0"; MdlAgregar.Show(); } catch (Exception ex) { lblInformacion.Text = ex.Message; mdlInformacion.Show(); } }