Skip to main content


Showing posts from March, 2013

ASP.Net MVC: Getting started with MVC, HelloWorld Application and passing data from Controller to View

Now we have learned the basics of ASP.Net MVC and typical folder structure of MVC application.

·So let’s start with sample “HelloWorld” application (as we normally do whenever we learn any new language).
·Select File -> New -> Project, select ASP.Net MVC 3 Web Application and give application a name as “HelloWorldApp” and click OK.

·New ASP.Net MVC 3 Project wizard opens; oAs you can see in snapshot there are three templates (Empty, Internet Application and Intranet Application), we’ll use Empty template for this project. oThere are two options to write view for our MVC application “ASPX” (aspx pages) and “Razor”, let’s select “Razor” as option and click OK.

·Our new project is ready to start, let’s have a look on Solution Explorer.

·As you can see there is no controller, let’s add a new controller, Right click on Controllers folder -> Add - > Controller.

·Provide a name to your controller as “HelloWorldController”, there are three options of Template, select “Empty controller” a…

ASP.NET MVC : Folder structure of ASP.NET MVC application

So we have learned the basics of ASP.Net MVC, now before start using it in our application, let's have a look on folder structure of a typical ASP.NET MVC.
The MVC framework is based on default naming and the folder names are equal in all MVC applications. Controllers are in the Controllers folder, Views are in the Views folder, and Models are in the Models folder. This standard naming reduces the amount of code, and makes it easier for developers to understand MVC projects.

Folder structure of MVC3 Application
A typical ASP.NET MVC web application has the following folder content:
Application information •Properties •References Application folders •App_Data Folder •Content Folder •Controllers Folder •Models Folder •Views Folder •Scripts Folder Configuration files •Global.asax •Web.config
Properties: Contains Application properties, i.e. AssemblyInfo.cs

ASP.Net MVC Basics, Framework Request Flow, Why should we use ASP.Net MVC and Pre-requisite for MVC

Model View Controller (MVC): The Model-View-Controller (MVC) design pattern is an architectural design patterns for any standard development that separates the components of an application. This allows application to handle very flexible and extensible and easy to handle.
The MVC model defines web applications with 3 logic layers: i.e. the business layer (Model logic), the display layer (View logic), and the input control (Controller logic)
ASP.NET MVC Framework having three main components
1.Model:  It is the part of the application that handles the logic for the application data. Often model objects retrieve data (and store data) from a database. This manages the behavior and data of the application domain, responds to requests for information about its state from the view, and responds to instructions to change state. Basically MVC Model contains all application logic (business logic, validation logic, and data access logic), except pure view and controller logic.
2.View: It is the par…

Using jQuery with Other Libraries - The noConflict() Method of jQuery

As you are already aware that jQuery uses the $ sign as a shortcut for jQuery. But what if any other JavaScript frameworks like Prototype, MooTools, Knockout, JavaScript MVC, Google Web Toolkit, Google Closure, or Ext JS also use the $ sign as a shortcut or what happen if you are using more than one jQuery library on your page. "In such cases you have two different frameworks or libraries using the same shortcut, which might result in that your scripts stop working."
So here comes the benefit of jQuery noConflict() method which releases the hold on the $ shortcut identifier, so that other scripts can use it. ·This function give control of the $ variable back to whichever library first implemented it. ·This helps to make sure that jQuery doesn't conflict with the $ object of other libraries.
Example 1: Use $ as shortcut for first library. You'll still be able to use "jQuery" for other library to avoid conflict.
<html> <head> <scriptsrc="prototype.…