.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> ASP.NET >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Single File Mode in ASP.NET Tutorial

Posted By:Nikhil Kumar       Posted Date: January 12, 2010    Points: 25    Category: ASP.NET    URL: http://www.dotnetspark.com  

In this tutorial we will see step by step procedure how to create a Single File Mode Example in ASP.NET using Visual Studio 2005 or Visual Studio 2008.
 

Here I will show you step by step procedure how to create a Single File Mode Example in ASP.NET using Visual Studio 2005 or Visual Studio 2008.

What is Single File Mode Application?
In a typical ASP.NET application, you have a UI page (ASPX file) and a code behind (.cs or .vb) file. A Single File Mode application means you will write and compile your C# or VB.NET code in the ASP.NET page itself inline. There will be no code behind file.

To create this application, I am using Visual Studio 2008 but you can use Visual Studio 2005 if you are running Visual Studio 2005.



Let's try our sample.

The Steps are:
  1. Start -> All Programs -> Visual Studio 2005 or Visual Studio 2008

    Now The Visual Studio will open like this:-

     1.jpg

  2. Now go to File Menu -> New -> Web Site

    When you will click on the New Web Site a new form will open like this:-

     2.gif

  3. Under Visual Studio Installed Template-> Choose ASP.NET Web Site -> Choose File System from the location combo box -> Set the path by the browse button - > Choose the language from the Language ComboBox (Visual C# , Visual Basic , J #)

    Choose Visual C#
     
  4. Click on the OK Button:-

    Now you will see a new from like this :-

    3.gif

    This is the Source Code window and in this page you will se this code.

    First you have to learn XML and HTML to work with ASP .NET.

    I have used <"text"> to make the text as comment this is the way to make comment in this code.
    <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
    
    
    
    Type your webpage title here  
    
    
    
    
    <"In between div tags you can manage your web controls like buttons, labels, picture Box, ImageMap etc">

    See here is a tab named Design in the bottom of this page
     
  5. Click on this tab and you will see a blank web page where you can drag any control from the toolbox (which is in the left side of this window)
     
  6. Drag a Button and a Label from the Toolbox window, and add a tag in the button code like this:

    
    Text="Click Me!"> 
    

    <"Here I used a line "Welcome to ASP.NET 3.5" you can type any line here as you like -->
     
  7. Now add this code in the source window like this:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
    
    
    
    
    Single-File Page Model
    
    
    

     

  8. Now Run your web site by Ctrl + F5
     
  9. Click the button
     
  10. When you will click on the button the label which you have taken will show you the current date and time of your computer...
     
  11. Close web browser
     
  12. Close visual studio
Thanks
 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend