2005 Conversion changes Public Classes into Partial Classes

Last post 02-01-2008 2:55 PM by mgodoy_desenv. 1 replies.

Sort Posts:

  • 2005 Conversion changes Public Classes into Partial Classes

    02-01-2008, 1:33 PM
    • Member
      27 point Member
    • Broodmdh
    • Member since 08-18-2005, 4:53 PM
    • Posts 87

    It appears that when my project went through the conversion process, the public classes (code-behind pages for the aspx forms) were converted into Partial Classes.  When I referenced these classes (as public classes) in 2003 there were no problems, but now that they are partial classes I get the following error:

     

            "Name 'PartCustomerOrderScreen' is not declared."

     

    Is it possible to refer to the partial class in the same way that I did the public class?  Both reside in the same namespace, but intellisense doesn't give me the option (and the build fails).  I don't understand the reasoning behind this change.  Any ideas?

  • Re: 2005 Conversion changes Public Classes into Partial Classes

    02-01-2008, 2:55 PM
    Answer
    • Contributor
      2,539 point Contributor
    • mgodoy_desenv
    • Member since 02-22-2007, 2:12 PM
    • São Paulo - Brazil
    • Posts 453

    Hi, in ASP.NET 2, each single page is a Assembly. To a Page class can be used by another one, that classes must to exist in App_Code special folder.

    Many problems I was get when I was converting ASPNET 1 website to ASPNET 2. I recomend to you to create from begin a new website in ASPNET 2. If you really need convert this website, the best solution is create a new class in App_Code special folder. That class needs to inherit Page class. So, you place all the methods that all pages need to use. At last, the class of pages (code-behind) needs to inherit the class that you create in App_Code. This way, with casting, you can to use the methods that before exist in another page.

    Excuse me for my way of writing. I don´t speak English so much...

Page 1 of 1 (2 items)