I have a small web application.
This is what I want to do: Create partial classes to split up a code behind file. Why am I not able to create partial classes directly?
If this is the codebehind file:
using System;
using System.Configuration....
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Test();
}
}
And also create this class:
public partial class _Default
{
public void Test()
{
}
}
I get an error message, Test doesn't exists in current context.
Why is this?
I get everything to work if I create a couple of partial classes which inherits from System.Web.UI.Page and then inherit my codebehind file from this class (the result of the partial classes). Is this the only way?
Has is something to do with that the codebehind and the aspx-page is dynamically compiled into a class?
Would appreciate if anyone could answer my problem. Things are working out right now but I would prefer to create the partial classes at the same "level" as the codebehind and avoid to use inheritance.
Thank you /John
(note that I have underscore in front of both classes but only one is visible in the preview, I don't know why..)