System.Web.UI.UserControl”,因此此处不允许

ASP.net中出现不扩展类“System.Web.UI.UserControl”,因此此处不允许。此类问题时。

这个问题是在我使用用户控件加载数据时出现的错误!

在 aspx。cs 页面 直接可以这样 用

 public partial class UserLogin : System.Web.UI.Page


但 当我把页面做成用户控件 WebUserControl 在后台 

public partial class WebUserControl: System.Web.UI.Page
就会报这个错误
WebUserControlTop 不扩展类“System.Web.UI.UserControl”,因此此处不允许。

因为,用户控件是绝对不可以继承页面类System.Web.UI.Page,这是可以肯定的,但用户控件的属性可以改。

 解决的方法:

public partial class WebUserControl:  UserControl 这样就可以用了

原文地址:https://www.cnblogs.com/zgaspnet/p/2426977.html