2016-10-13 51 views
0

我必须这样做的原因是因为在另一个页面上,它必须继承dll类的名称。我如何能够在另一个aspx窗体中打开aspx窗体?

E.g. beePlugInIntegration.index使dll代码工作。

但是,我不能简单地改变主页面继承类,因为整个系统会崩溃。

最后,我在想的是打开主页面中的子页面,所以我能够继承这两个类并使其工作。但是我所做的是使用

BeePlugInSection.Controls.Add(LoadControl("~/index.aspx")) 

但是它返回我这个

Server Error in '/WebLITE' Application. 

Type 'ASP.index_aspx' does not inherit from `System.Web.UI.UserControl`. 

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Web.HttpException: Type 'ASP.index_aspx' does not inherit from 'System.Web.UI.UserControl'. 

Source Error: 

有人可以帮助我在ASPX打开另一个表单类?

+2

只需创建一个自定义控件并将其加载到index.aspx和其他任何需要它的地方。 – Filburt

回答

0

你的异常清晰地说

类型 'ASP.index_aspx' 不从 'System.Web.UI.UserControl' 继承。

表示您必须使用UserControl而不是Page。

因此,创建一个用户控件,在页面或web.config上注册并使用它。

+0

但继承beePlugInIntegration.index类不属于userControl,它是一个页面 –

+0

如果使用用户控件,则它已经从UserControl类继承。您只有2个选项,即cumtom控制或用户控制。后来一个非常简单直接。 – Imad

相关问题