Can anyone tell me what are the differences between code beside and code behind in Asp.NET?
See Question&Answers more detail:osCan anyone tell me what are the differences between code beside and code behind in Asp.NET?
See Question&Answers more detail:osCodeInPage: which means putting our code into our page.
CodeBehind is a separate file for the code. This file derives from Page, contains declarations for the server controls, and contains all the event handlers and such. The aspx file then derives from this class for the final page.
The two problems that CodeBehind solves is that intellisense needed 1 language per file to work, so the serverside code was put in one file and we are happy. It also eases the compiler pain of detecting bugs in serverside code, as it only needs to deal with the code files by themselves, not the ui declaration mixed in.
Code-Beside allows one class to be defined in multiple source files.
The main intended use for Partial Types is to allow code generators to create a class that can be extended in a separate file to not mess up any re-generation.
Refer to the following article: