0

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 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.

1
  • 1
    What are you trying to achieve with the include file. Could you achieve the same result with a UserControl? Commented Nov 1, 2009 at 23:20

1 Answer 1

5

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".

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.