开发者

ASP.NET Include Disables Code-Behind

I've found that when using the

<!-- include file="MyPage.aspx" --> 

command in ASP, I'm not able to use the code-behind in MyPage.aspx.

The issue is that when I try to include MyPage.aspx, there is an error because we have two Page Directives. If I remove the Page Directive, I can include MyPage.aspx just fine, but cannot access the code-behind, because the "CodeBehind" parameter in the Page Directive is no longer there.

So, as far 开发者_StackOverflow中文版as I can tell, we have a Catch-22. Does anyone know of a work-around for this? Or is there just something I'm missing?

Thanks, -Onion-Knight

I'm not sure if this changes anything, but I am using a Master Page with the page that includes MyPage.aspx.


Why don't you use a user control (*.ascx) instead of including an aspx page?

Have a look at this overview in MSDN which shows how to create and user "user controls".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜