Adding Simple Code to ASP .Net Page

by top54u.com 29 Oct, 2007
Spotlight.....

 

Using the same <% %> code blocks developer can modify the HTML output dynamically likewise in simple asp pages.
The below example demonstrates how <% %> blocks can be used to modify text output of an HTML block increasing the font size each time:

<html>
   <head>
        <title>ASP.Net Code Page</title>
   </head>
<body>
          <% for i as integer= 1 to 6 %>
                <font size="<% =i %>">Hello</font><br/>
          <% next %>
</body>
</html>

Save above code as example3.aspx and check the output.

 

ASP.Net VB-C# Date Time Function

VB CODE FOR VB NET DATE TIME FUNCTION

<%@ Page Language="VB" %>
<html>
<body>
           <h1>VB.Net Date Time Function</h1>
           <br/>
           <h2>The date and time is <% =DateTime.Now( ) %>.</h2>
</body>
</html>

C# CODE FOR C# NET DATE TIME FUNCTION

<%@ Page Language="C#" %>
<html>
<body>
           <h1>C#.Net Date Time Function</h1>
           <br/>
           <h2>The date and time is <% =DateTime.Now.ToString( ) %>.</h2>
</body>
</html>

You can copy above asp.net code to get current server date time.
DateTime.Now( ) function runs on server side and returns the server current date and time.

Take care of including the page headers

For VB page header use:
<%@ Page Language="VB" %>

For C# page header use:
<%@ Page Language="C#" %>

You can build your dynamic asp .net web site by using Visual Web Developer Express Edition. Click here to learn how to install asp .net on your PC.

Spotlight.....

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

8/23/2008 8:45:47 PM

OUR SPONSORS[+ advertise here]
related videos.....
recent posts.....
top54u ezines.....