Skip to main content

MVC 4 Hello world

Follow the below step to create MVC project

  1. Create MVC Project.
  2. Choose internet application.
  3. after click ok you will see a set of folder created, but just leave it as it is.
  4. Click run to execute (F5) and you will see nice page without need you to code single line. Done!!

How to display “Hello world”

  1. Right click “Controllers” folder and choose “Add> Controllers”, and in the controller name key in “HelloWorldContoller”, and leave the rest as default.
  2. Go to HelloWorldController.cs, paste the following code
and then right click on the function “Index”, and choose add View.


3. In the View name, key in “Helloworld” and leave the rest as default. Click OK.

4. You will noticed “HelloWorld” folder has been created under Views folder. then go to Index.chtml in this folder and type these code


  1. Click ‘F5′, and you’re done!

Comments

Popular posts from this blog

create a table in SQL

To create a table, you can follow this formula: CREATE TABLE Country( Column1 , Column2 , Column3 ) or: CREATE TABLE Country( Column1 , Column2 , Column3 ); Each column is created as: ColumnName DataType Options Here is an example: CREATE TABLE Customers ( DrvLicNbr nvarchar(32), DateIssued DATE, DateExpired date, FullName nvarchar(50), Address NVARCHAR(120), City NvarChar(40), State NVarChar(50), PostalCode nvarchar(20), HomePhone nvarchar(20), OrganDonor BIT); GO To start from a sample code, open an empty Query window and display the Template Explorer. From the Template Explorer, expand Table. Drag Create Table and drop it in the Query window: -- ========================================= -- Create table template -- ========================================= USE <database, sysname, AdventureWorks> GO IF OBJECT_ID('<schema_name, sysname, dbo>.<table_name, sysname, sample_table>', 'U') IS NOT NULL DROP TABLE <schema_name, sysname, d...

Stored Procedures

Practical Learning: Introducing Stored Procedures Start Microsoft  SQL  Server  Management  Studio  and log in to your  server On the main menu, click File -> New -> Query With Current Connection To create a new database, copy and paste the following code in the Query window:   -- ============================================= -- Database: WattsALoan -- ============================================= USE master GO -- Drop the database if it already exists IF EXISTS ( SELECT name FROM sys.databases WHERE name = N'WattsALoan' ) DROP DATABASE WattsALoan GO CREATE DATABASE WattsALoan GO -- ========================================= -- Table: Employees -- ========================================= USE WattsALoan GO IF OBJECT_ID(N'dbo.Employees', N'U') IS NOT NULL DROP TABLE dbo.Employees GO CREATE TABLE dbo.Employees ( EmployeeID int identity(1,1) NOT NULL, EmployeeNumber nchar(10) NULL, FirstName nvarchar(20) NULL, LastName nvarcha...

WPF Tutorial - Binding without XAML

The introduction of binding and XAML has made creating user interfaces in .NET a much more enjoyable experience compared to previous incarnations. Binding is such an integral part of the WPF experience that most developers thoroughly understand how to do it in XAML, however what we're going to look at today is how to create a binding using only C# code. I'm going to build a very basic example application - it has a TextBlock and a TextBox. Whatever is typed into the TextBox, will be reflected in the TextBlock. Here's a screenshot of what I'm talking about: This application lends itself perfectly to XAML binding, and in fact that's the first way I implemented it. <Window x:Class = "BindingWithoutXAML.MainWindow"         xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"         xmlns:x = "http://schemas.microsoft.com/winfx/2006/xaml"         Title = "MainWindow"     ...