Learn ASP.NET(C#) By Examples @ Nora Lamens 2009 |
Lesson-1 Save the following code as Ex01.aspx and run it in Browser. |
<%@
Page Language="c#"%> <html> <head> <title>Ex-01</title> </head> <body> Welcome Raja </body> </html> |
What you have learnt in this Lesson?
|
Lesson-2 Let us slightly modify the above code in our Lesson-2 and check the result: |
<%@ Import Namespace="System" %> <%@ Page
Language="c#"%>
|
What you have learnt?
|
Lesson 3: The code in Lesson-2 can be further complicated by introducing FUNCTIONS.. |
<%@
Import Namespace="System" %>
|
Lesson 4: In this lesson, we do nothing. We have simply replaced the Response.Write() by "=" short code. |
<%@
Import Namespace="System" %> |
Lesson 5: Let us further complicate our code by creating METHODS inside CLASSES and keep these classes in a separate file called as CODE-BEHIND FILE.When we use code-behind, there will be TWO files. One is aspx file and another one is aspx.cs file |
Code for Ex01.aspx file: |
<%@ Page Language="C#" CodeFile="Ex01.aspx.cs"
Inherits="Ex01" %> <html> <head> <title>Ex-01</title> </head> <body> </body> </html> |
Code for Ex01.aspx.cs file: |
using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class
Ex01 : System.Web.UI.Page protected void myMethod(string x) |
The output of all the five lessons are same. you will get " Welcome Raja". |