hello word asp .net website

Hello friends!!

Today I am starting tutorial of basic asp .net web application development using c# scripting language. And I will show you how we can develop a very basic web application which will just use basic controls.

Open Visual Studio and click to file:

open a new asp dot net website
open a new asp dot net website

Now click on New and select web site :

creat new asp .net website
create new asp .net website

You can also use short cut key Shift+Alt+N to create a new website:

select language c sharp to start website
select language c sharp to start website

Name the project and select C# as language for your project and select location by browsing location and click ok to start website project. In this example I name the project as HelloWorld.

As You can see after clicking ok there will be a document named Default.aspx  in which there should be some text which is a website normal html tags like <html>, <head>, <title> and <body>.

There will be a <div> tag inside <form> tag. We have to put all the designing controls and html tags inside this <form> tag.

We can use <br /> fro new line .

In the example I use a static line,some labels (Server side control) and Textbox and a Button.

simple website design
simple website design

You can switch to design view to see how your website will look like by clicking on Design tab. Follow the picture.

switch to design view from source view
switch to design view from source view

Here is our design view look of our hello world website.

Now Double Click on the Button.

This will open the code view where will write server side code(Scripting).

design view of hello world website
design view of hello world website

Now we will write some code to print hello word text in the textbox and label. Follow the code in the picture.

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
lblDynamicText.Text = “Hello World!, This is my first asp .Net website using c# as scripting language”;

}
}
protected void btnPrompt_Click(object sender, EventArgs e)
{

lblDynamicText.Text = txtMessage.Text;

}
}

Now we will run the project to see the result. To run the project we have to press F5.

Or we can also follow the menu Debug-Start Debugging.

First time when we will run the project i.e. debug the project, there will be a prompt to modify the web.config file to enable debugging.. We will press Ok to start debugging.

enable start debugging by modifying web . config file
enable start debugging by modifying web . config file

This is website source code for website design.

<%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”Default.aspx.cs” Inherits=”_Default” %>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head runat=”server”>
<title>Hello Word Website</title>
</head>
<body>
<form id=”form1″ runat=”server”>
<div>
Hello World using static text.
<br />
<asp:Label ID=”lblDynamicText” runat=”server” Text=”Label”></asp:Label>
<br />
<asp:TextBox ID=”txtMessage” placeholder=”Write here something and press Button” Width=”300px” runat=”server”></asp:TextBox>
<br />
<asp:Button ID=”btnPrompt” runat=”server” Text=”Button”
onclick=”btnPrompt_Click” />
</div>
</form>
</body>
</html>

 

hello world website view in web browser
hello world website view in web browser

 

Here we can see result by putting anything in the TextBox and Clicking on the Button to see the result.

See some responses in the picture.

hello word website  responses after click on Button
hello word website responses after click on Button
hello world some more responses
hello world some more responses

 

 

 

 

 

 

 

Enjoy the website and happy coding.

13 Replies to “hello word asp .net website”

  1. quest bars

    I was recommended this web site by my cousin. I’m not
    sure whether this post is written by him as nobody else know such detailed about my difficulty.
    You are incredible! Thanks!

  2. quest bars

    Hello There. I found your blog the usage of msn. This is a really smartly written article.
    I’ll be sure to bookmark it and return to read extra of your useful information. Thanks for the post.
    I’ll certainly return.

  3. LucileQFelux

    This is very interesting, You are a very professional blogger.
    I have joined your rss feed and look forward to looking for extra of your excellent post.

    Also, I have shared your website in my social networks

  4. ReedPTeetz

    Hi there! I was able to have sworn I’ve visited this site before but after going
    through several of the articles I realized it’s a new comer to me.
    Anyways, I’m definitely happy I discovered it and
    I’ll be book-marking it and checking back often!

  5. PhoebeTPhu

    Wonderful goods from you, man. I’ve understand your
    stuff previous to and you might be just too wonderful. I really like what you may have acquired here, certainly like what
    you will be stating and the way for which you say it. You make it entertaining and you also
    still care for to maintain it wise. I can’t wait to read through significantly more of your stuff.
    This can be actually a tremendous website.

  6. HayleyLVicoy

    Link exchange is definitely not else but it really is simply placing
    other person’s weblog link on your own page at appropriate
    place and other person may also do same in support of you.

Leave a Reply

Your email address will not be published. Required fields are marked *