Validating the user input and showing a user-friendly error message is an important step in Web Application development. ASP.NET MVC framework provides validation features which helps developer to validate model values. The validation features in MVC allows you to write the validation using attributes which is called data annotations. This post outlines the data annotation features that you can...
Seeding a Database in Entity Framework
The code-first approach of Entity Framework creates the database in LocalDB instance of SQL Server Express. The Entity Framework uses the model’s property names and data types to create the tables.Entity Framework uses EdmMetadata table to synchronize model classes with the database schema. To keep the database in sync with the model you need to re-create an existing database using Entity...
Scaffolding in ASP.NET MVC4
What is Scaffolding? Scaffolding in ASP.NET MVC generates the code for create, read, update and delete operations in your application. This post outlines the different Scaffolding templates available in MVC4. If you do not like the default scaffolding then you can customise the code generation.You need a model to start working with scaffolding so build a model first by creating new ASP.NET MVC4...
ASP.NET MVC RAZOR View Engine Overview
ASP.NET MVC contains two view engines named Razor view engine and Web Forms view engine. This post outlines the Razor view syntax, sample code expressions, code blocks, layouts and compares some code expressions with Web Forms view engine.The Razor View engine was introduced in ASP.NET MVC3 and it is default view engine that you get when you create new MVC project in Visual Studio. Razor view...
ASP.NET MVC 4 Application Templates explained
When you create a new MVC 4 project in Visual Studio 2012, you will be presented with different option as shown in the below picture, Each project template sets up different folders in your application. This post explains the each project template purpose Empty Template The new Empty Template has got assemblies, web.config and basic folder structure. No default page, you have to add everything...
ASP.NET MVC Release History
ASP.NET MVC is a framework for developing web applications and first version was released on year 2009. Thanks to ScootGu who introduced this framework for ASP.NET Web Development. If you wonder why Microsoft released another framework when there is Web Forms then read this post. This post outlines the ASP.NET MVC release history and their features. ASP.NET MVC 1 ASP.NET MVC 1 was released on...
Creating and Deploying an ASP.NET MVC4 Application
This post gives you an introduction to MVC model and outlines the steps in creating a new site and adding a model, controller and view using entity framework code first. It also gives you the steps to deploy this site to Windows Azure Web Sites. How MVC Works? User sends a request to your web site and that request through a feature called routing goes to controller, In MVC URL does not maps to a...
Single Page Applications using ASP.NET
What is Single Page Application? Single Page Application is an architecture for web applications. It combines the best of web and desktop, built with HTML5 and JavaScript.Single Page Applications are rich and responsive. You do not need any browser plug-ins needs to install for this architecture, it is a standard web technology that is going to work on any device, operating system and browser...