If \(\alpha >-1\) the space of Dirichlet type \(\mathcal {D}^2_\alpha \) consists of those functions f which are analytic in the unit disc \(\mathbb {D}\) such that \(f^\prime \) belongs to the weighted Bergman space \(A^2_\alpha \) . The space \(D^2_0\) is the classical Dirichlet space \(\mathcal {D}\) . If g is an analytic function in \({\mathbb D}\) , we study the generalized Hilbert operator \(\mathcal {H}_{g}\) defined by \(\begin{aligned} \mathcal {H}_g(f)(z)=\int _0^1f(t)g'(tz)\,dt \end{aligned}\) acting on the spaces \(\mathcal {D}^2_\alpha \) ( \(0\le \alpha \le 1\) ). We obtain a characterization of those g for which \(\mathcal {H}_g\) is bounded, compact, or Hilbert-Schmidt on the Dirichlet space \(\mathcal {D}\) . In addition to this, we use our results concerning the operators \(\mathcal {H}_g\) to study certain Cesàro-type operators \(\mathcal {C}_{(\eta )}\) acting on the spaces \(\mathcal {D}^2_\alpha \) ( \(0\le \alpha \le 1\) ). We give also a characterization of the positive finite Borel measures \(\mu \) in [0, 1) for which a certain Cesàro type operator \(\mathcal {C}_\mu \) associated to \(\mu \) is bounded on the Bergman space \(A^1_\alpha \) ( \(\alpha >-1\) ). This is an extension of the previously known results for the spaces \(A^p_\alpha \) with \(p>1\) and \(\alpha >-1\) .