This article will demonstrate us about best practices which should be used when working with Asp.Net MVC application. 



Today I am going to explain about how to get JSON data with Asp.Net MVC. As we know JSON is very light weight as compare to xml or other datasets. So, in this article, I will create a blog system where first you will bind the dropdown with blog categories and on select on individual category, blogs details will be populated. For this demonstration, I have used Code First approach.



MVC or Model View Controller is a software design pattern to develop web application.  MVC is not a new concept created by Microsoft to develop Web application in Asp.Net MVC. Even MVC is also used to develop iOS framework. So, we can say it is a general concept of Software Development. MVC is stand for Model View Controller. In short. Model is Data objects like Business logic, validation and DB access.View is User Interface (UI) and Controller handles the user request and work with View and Model.



Asp.Net MVC is nothing but a framework introduce by Microsoft. It is lightweight and open source. It is used to building highly testable, scalable and well designed clean application. Microsoft introduce first MVC version MVC 1.0 in 2009. Here I am explaining all the versions and its feature.



DropDownList allows user to select an item from the dropdownlist So, Today I am going to explain how to bind dropdownlist in Asp.Net MVC and How to validate dropdownlist on button click without select any value. I have taken a example to bind categories list in dropdownlist. The first step is to create a ViewModel for dropdownlist . I have bound the dropdownlist in controller. In this ViewModel, I have taken Postcategories as List type and a SelectValue as int to store the selected value.  



Repository Pattern is used to create an abstraction layer between data access layer and business logic layer of an application. Repository directly communicates with data access layer [DAL] and gets the data and provides it to business logic layer [BAL]. The main advantage to use repository pattern to isolate the data access logic and business logic, so that if you make changes in any of this logic that cannot effect directly on other logic.



If we use same name controller in Area and Root in Asp.Net MVC application than we will conflict and throw an error like below.

~/Controllers/HomeController.cs

~/Areas/Blog/Controllers/HomeController.cs

Multiple types were found that match the controller named 'Home'. This can happen if the route that services this request ('{controller}/{action}/{id}') does not specify namespaces to search for a controller that matches the request

.To resolve it we have to provide the proper namespace when creating route for both.



In this articles, I will try to explain the structure of Asp.Net MVC project. When we create a new project than there are lots of folders and files are available. So, what is the purpose of these folders and files. Why we use Model, Controller, View, Areas, App_Data etc folder. What type of files manage inside it..



Today, I am going to demonstrate what is routing in Asp.Net MVC and how do we use it in our Asp.Net MVC application. Routing is used to map the incoming request to particular MVC controller action. So, Routing is a pattern matching system that map incoming request with specific action. Route table is used to decide at run time to match the incoming request by Route Engine.



Today, I am going to demonstrate how to create custom routing in Asp.Net MVC application. I hope you all know the routing concept; in short routing is used to map the incoming request to particular MVC controller action. It also customizes your url which looks neat and clean. But today, I will not explain the routing concept, like what is routing in detail, how it work, how we can create etc. Actually I will try to explain the Custom Routing concept.  When you request for Asp.Net MVC page then it passes through the routing architecture. 




Pages : 1 2

Search
Latest eBook Download
Categories
Category Loading....
Recent Articles
Recent Articles Loading....
Popular Articles
Popular Articles Loading....
Follow Us