Monday, June 21, 2010

First Asp Programe

Now let us have our First ASP.NET program.
Let9s 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" %>


Supermegacineplexadrome!

Welcome to
Supermegacineplexadrome!



Showtimes for <%WriteDate();%>

<%WriteMovies();%>


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()
{
Response.Write(DateTime.Now.ToString());
}
protected void WriteMovies()
{
Response.Write("The Glass Ghost (R) 1:05 pm, 3:25 pm, 7:00 pm
");
Response.Write("Untamed Harmony (PG-13) 12:50 pm, 3:25 pm, " +
"6:55 pm
");
Response.Write("Forever Nowhere (PG) 3:30 pm, 8:35 pm
");
Response.Write("Without Justice (R) 12:45 pm, 6:45 pm
");
}
}

0 comments:

Post a Comment