Page 41 - DCAP312_WEB_TECHNOLOGIES_II
P. 41

Unit 2: Introduction to C#



               3.  The fields is ...........................                                      Notes
                 (  a)  high level language      (b)  class-level variables
                 (  c)  declares                 (d)  class-level defender

               4.  The .......................... are stored in the assembly data region.
                 (  a)  stack                    (b)  black

                 (  c)  namespace                (d)  constant local variables
               5.  Web user controls are ............
                 (  a)  aspx page                (b)  Black
                 (  c)  Derived from System      (d)  local area

            2.3 Introduction to In-line Script


            The ASP.Net web pages sustain both kinds of coding models: code-behind as well as in
            sequence code. The difference between them is the in sequence code model enables to write the
            code statements in the .aspx page beside with HTML source code using <script> tag whereas
            code-behind model separate the .aspx page and server-side code. You can write the code in
            a disconnect .cs or .vb code file derived from Page class especially for each .aspx page. The
            other very important difference is that the inline code is deployed along with the .aspx web
            page when a compiled web application is published online whereas the code-behind approach
            compiles the code for all web pages into a .dll file that enables to host the web pages free from
            any inline server code.
            Using this  syntax, you can use in sequence code in ASP.NET (.aspx)  pages. The server-side
            code will be mechanically compiled by the .NET framework the first point in time the page
            is requested on the server. The compiled .dll file is stored in the “Temporary ASP.NET Files”
            system folder. Changing the code in .aspx files will trigger a new compilation, generating new
            .dll files. The old .dll files are phased out by the framework and eventually deleted.
            <%@ Import Namespace=“System” %>
            <%@ Page Language= “c#”%>
            <script runat=“server”>
                  public string ServerSideFunction(string input)
                {
                  return “Hello” + input;
                }
            </script>
            <% string pageVariable = “world”; %>
            <! DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
             “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
            <html xmlns= “http://www.w3.org/1999/xhtml” xml:lang= “en” lang= “en”>
            <head>
            <meta http-equiv= “Content-Type” content=“text/html;
            charset=windows-1252”/>
            <title>ASP.NET inline</title>
            </head>



                                             LOVELY PROFESSIONAL UNIVERSITY                                    35
   36   37   38   39   40   41   42   43   44   45   46