Tuesday, 29 December 2015

First ASP.NET Program

First ASP.NET Program.

Now let us have our First ASP.NET program.
Let’s look at both the markup and the C# portions of a simple web forms application that generates a movie line-up dynamically through software.

Markup Portion

Web form application part 1 -- SimpleWebForm.aspx

<% @Page Language="C#" Inherits="MoviePage" Src="SimpleWebForm.cs" %> 

<body background="Texture.bmp">


<H1 align="center"><FONT color="white" size="7">Welcome to 

<P align="left"><FONT color="lime" size="5"><STRONG>

<U>Showtimes for <%WriteDate();%></U>


<FONT size="5" color="yellow"><%WriteMovies();%></FONT>

And this is where the C# part of a web forms application comes in.

Web form application part 2 - SimpleWebForm.cs

using System;
using System.Web.UI;
using System.Web.UI.WebControls;

public class MoviePage:Page 
    protected void WriteDate()

    protected void WriteMovies()
        Response.Write("<P>The Glass Ghost (R) 1:05 pm, 3:25 pm, 7:00 pm</P>");
        Response.Write("<P>Untamed Harmony (PG-13) 12:50 pm, 3:25 pm, " + 
                       "6:55 pm</P>");
        Response.Write("<P>Forever Nowhere (PG) 3:30 pm, 8:35 pm</P>");
        Response.Write("<P>Without Justice (R) 12:45 pm, 6:45 pm</P>");
Post a Comment