ASP.NET : Web Server Control

Web Server Controls
Like HTML server controls, Web server controls are also created on the server and they require a runat="server" attribute to work. However, Web server controls do not necessarily map to any existing HTML elements and they may represent more complex elements.

Figure 1: Web Server Control
Syntax
  <asp:controlname id="id" runat="server" />

Example
  Show ID and Name on the Label when click at the button

Figure 2: Webpage

Figure 3: Source code HTML


Figure 4: C# Code Behind Page
Code Behind Page
-  The code-behind page model allows you to keep the markup in one file—the .aspx file—and the programming code in another file. The name of the code file varies according to what programming language you are using
-  For example, if you are working with a page named SamplePage, the markup is in the file SamplePage.aspx and the code is in a file named SamplePage.aspx.cs (for C#), and so on

figure 4: Single and Separate File

Figure 5: Relation between HTML and Code Behind Page

##############################

HTML Server Control << Previous Chapter || Next Chapter >> Page Life Cycle

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...