Ejemplo n.º 1
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals(ComandosGrid.Editar.Value))
            {
                int RowIndex = Convert.ToInt32((e.CommandArgument).ToString());
                hdfEditID.Value = (GridView1.Rows[RowIndex].FindControl("id") as Label).Text;

                List <tipo_documento> ListaTipoDocumento = new List <tipo_documento>();
                ListaTipoDocumento = Mgr_Documento.Get_TipoDocumento(Convert.ToInt32(hdfEditID.Value));

                Mgr_Sucursal.Lista_Sucursal(ddlSucursalEdit, ObjUsuario.Id_empresa);

                foreach (var item in ListaTipoDocumento)
                {
                    txtNombreEdit.Text    = item.nombre;
                    txtDirigidaEdit.Text  = item.dirigida;
                    txtModalidadEdit.Text = item.modalidad;
                    if (item.fecha != null)
                    {
                        txtFechaEdit.Text = item.fecha.Value.ToString("yyyy-MM-dd");
                    }
                    txtResponsableEdit.Text       = item.responsable;
                    txtAprobadoEdit.Text          = item.aprobado;
                    txtArchivadoEdit.Text         = item.archivado;
                    ddlEstatusEdit.SelectedValue  = item.estatus;
                    ddlSucursalEdit.SelectedValue = Convert.ToString(item.id_sucursal);
                }

                Modal.registrarModal("editModal", "EditModalScript", this);
            }
            if (e.CommandName.Equals(ComandosGrid.Eliminar.Value))
            {
                int    RowIndex = Convert.ToInt32((e.CommandArgument).ToString());
                string valor    = (GridView1.Rows[RowIndex].FindControl("id") as Label).Text;
                hdfIDDel.Value = valor;

                Modal.registrarModal("deleteModal", "DeleteModalScript", this);
            }
        }