Skip to main content

Posts

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 the  typical folder structure of MVC application. ·          So let’s start with a 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 the application a name as “HelloWorldApp” and click OK. ·          New ASP.NET MVC 3 Project wizard opens; o    As you can see in the snapshot there are three templates (Empty, Internet Application, and Intranet Application), we’ll use the Empty template for this project. o    There are two options to write view for our MVC application “ASPX” (aspx pages) and “Razor”, let’s select “Razor” as an option and click OK. ·          Our new project is ready to start, let’s have a look at Solution Explorer. ·          As you can see there is no controller, let’s add a new controller, Right-click on the Controllers folder -> Add - > Co

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 at the 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: Contai

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 pattern for any standard development that separates the components of an application. This allows applications 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 has 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

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 happens 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 your scripts stopping working." So here comes the benefit of the jQuery noConflict() method which releases the hold on the $ shortcut identifier, so that other scripts can use it. ·          This function gives 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 a shortcut for the first library. You'll still be able to use "jQuery" for another library to a