Blocks

Certify and Increase Opportunity.
Be
Govt. Certified ASP.NET Programmer

Blocks

The ASP.NET single-file page model is similar to Active Server Pages (ASP) page structure in that script blocks that contain code come before HTML, and special markup tags can be used in the HTML. This topic describes the issues involved in updating your ASP code to ASP.NET.

The ASP.NET code-behind page model separates script-block code from the HTML and ASP.NET markup tags. For more information. For information about data-binding syntax that enables you to bind control property values to data.

All ASP.NET procedures and global variables should be declared within <script runat=”server”> blocks placed before the opening <html> tag, not between ASP <%…%> style delimiters. You can still declare variables in <%…%> render blocks, but they will be accessible only to other render blocks on the page, not globally to other functions or procedures. A page can contain more than one script block, but the programming language must be the same in all blocks on a page.

With ASP, code was enclosed within <%…%> tags and page processing began with the first statement following the first <%> tag. With ASP.NET, any code that is to be processed as soon as the page is loaded must be included within the Page_Load intrinsic event. You can still write code in <%…%> blocks, but it will be executed at render time (in top-down fashion, as in ASP) after the page is loaded. If you need to execute initialization code, it should appear in the Page_Load event, which is raised immediately after the page is loaded by the ASP.NET engine.

Get industry recognized certification – Contact us

Menu