Archive for the ‘mvc’ Category

ASP.NET MVC Model Binders map posted form values to a .NET classes, instead of accepting primitive parameters or form value collection you can accept models/view models as input to your action methods. ASP.NET has a default model binder called DefaultModelBinder. It basically works with most of the .NET types like primitive types, arrays, IList, ICollection [...]

In one of my previous blog post I mentioned about ASP.NET MVC action filters. Action filters provides us to ability create an aspect oriented approach in ASP.NET MVC application. It’s not the only way off course, IoC containers provide this ability too. Specially in enterprise level applications you can use IoC containers to create wrappers [...]

jQuery validate plugin provides us to validate HTML forms. jQuery validate plugin disables submitting the for until all specified validation rules are valid. It shows an error label next to invalid field and informs users about input errors. ASP.NET MVC 3 uses jQuery validation (http://docs.jquery.com/Plugins/validation) for form validations and jQuery validation library has a remote [...]

Before I write some code and sample oriented articles about ASP.NET MVC Framework Action Filters. I want to make a quick introduction and talk about filters. You may need to do something before or after your action methods get executed. ASP.NET MVC Framework provides some level of filters to do that kind of things. Filters [...]

In my previous blog entry (How to create custom HTML Helpers for ASP.NET MVC 3 and Razor View Engine) I mentioned extensibility point of Razor View Engine to change view/page base class type. It’s not a new approach for ASP.NET developers, we have been applying same pattern for ASP.NET Web Pages too. You have to [...]

I will try to show you a basic feature of ASP.NET MVC, creating custom HTML Helpers. We can reduce the amount of logic in view pages (razor or asp.net –aspx- pages) by extracting logic code as method. HTML Helper methods are nothing more than methods that are returning string. If you want to write your [...]

If you are working in a RESTful project or an ajax based web application probably you will need to return http error codes with custom content. Like returning a custom XML message from your endpoint with a specific (like 400 BadRequest) HTTP Status Code. [HttpPost] public ActionResult Create(Customer customer) { var validationResult = _validator.Validate(customer); if [...]

I needed to export some data as CSV file. And I decided to create an action result to return correct format. In my scenario DataTable was the best option to use as a data source. This code snippet shows how to export a DataTable as CSV file. As you know this file format can be [...]

I am using ASP.NET MVC framework from the time first beta bits released, I am big fan of this framework because of it’s extensibility and specifically simplicity. ASP.NET MVC framework activates the controllers when a request arrived to it’s pipeline. Default naming and structure rules of controllers are : Controller class name must ends with [...]


top