Skip to main content

Posts

Showing posts from January 31, 2010

How Code-Behind Files are Connected to web Pages in ASP.NET

Normally start of every aspx pages is referenced to the language and specific code behind file to excite the web page’s controls and events if it is not in a code-Inline structure. In traditional ASP.NET it is using Src attribute to point out the source code file or inherit attribute indicate the compile class name. In these both two approaches have several impairments when considering each other. But common problem is, both may add boilerplate code because of every time have to indicate web control with a member variable in these two methods. To overcome this problem ASP.NET provides oversaw keyword called partial, which has a capability to spit a single class into multiple source code files. Essentially, the model is the same as before, but the control declarations are shuffled into a separate file. You, the developer, never need to be distracted by this file; instead you can just access your web-page controls by name. In code behind file: public partial class TestFormCode