In my previous post I have described about how to create a simple page in only html. Let’s create a simple web pages in asp.net. This tutorial will help you to understand about mvc application and design your web website in asp.net with c#. For the learners, it is very tedious job to find out the tutorials which will show you how to create a website using asp.net. But this post will show you the easiest way. Here I am going to describe you to create a simplest webpage in asp.net. Before that, its recommended to go through asp.net tutorial for beginners .
Create a simple web pages in asp.net –
Step 1 :
First go to the FILE->New->Web Site then select ASP.NET Empty Web Site and then click OK. It means that you are ready to create a new, your own, web pages. Just insert below code in Source option, only html codes are in here. There is an option in visual studio to drag and drop each of your requirement instead of html coding. I have just shown you only div option.
Step 2 :
in step 2 we have to create a class for connecting with the Database. Create the class file for your new web page. Just follow the below process –
Right Click on the website 6(red mark on the image) option and then click on the Add – Add New Item and then select Class option and just paste the below code.
Step 3 :
Now the most important part that you have to connect with the database and go to the below option. mind it you should copy the connection string name from database and then paste it into the class file instead of insert connection string name from sql srver database.
Right Click on the website 6 option and then click on the Add – Add New Item and then select Sql Server DataBase and create your own database. Create database as per your requirement. Only few things to remember, always rename the database name and copy the connection string.
Step 4 :
Now just paste the below codes in .aspx page which is written in C# language. if you don’t find it then go to the the html page and double click on the button.
Step 5 :
Now you are waiting for your output. Yes after successful completion of all the steps, please go to run option and select on Run Without debugging or you may press F5 button from your keyboard.
If you have any more Query regarding asp.net , then feel free to ask here.
You may also check :