You must login or sign up to do that.
(click on this box to close msg)

ASP.NET MVC Tutorials

Guides, tips, and hacks
Dondon Vizcayno
How to Check if a Form is Valid in ASP.NET MVC Using JQuery
By Dondon Vizcayno on July 19, 2010
I have recently learned that it is possible to check the validity of a form using JQuery. Let us say that you have a form with several fields that uses data annotation in validation. Before doing an Ajax call you would want to check if...
Dondon Vizcayno
How to Create Custom MVC Data Annotation that Works Both in Server and Client Side
By Dondon Vizcayno on July 19, 2010
Creating custom data annotations in ASP.NET MVC is not really dificult. You just need to follow some steps that should be done, otherwise the data annotation might fail to work, maybe on the client side or on the server side. Here are...
Dondon Vizcayno
How to Return Json Objects in ASP.NET MVC
By Dondon Vizcayno on July 19, 2010
One of the things that surprised me with the MVC framework is how easy it is to return Json objects from the controller. It is really a one liner and it could not get any simpler. Let us say you have a Student class and after filling...
Dondon Vizcayno
How to Render an MVC Partial View Bound to an Inner Model
By Dondon Vizcayno on July 19, 2010
One of the new things I have learned lately is that you can pass a model to a partial view when it gets rendered. I knew that I can use strongly-typed partial views and bind them to a model. But I did not know that I can assign specific...
Dondon Vizcayno
How to Download PDF File from ASP.NET MVC Controller
By Dondon Vizcayno on July 19, 2010
One of the common tasks for web programming is allowing users to download a pdf file. Assuming that you have the means to create a pdf file and put it in memory, you can use the pattern below for downloading it to the user's...
Dondon Vizcayno
How to Page Objects in C# Using LINQ
By Dondon Vizcayno on July 15, 2010
In a previous post, we discussed how to dynamically sort objects using the Dynamic LINQ library. In this post, I will show you how easy it is to page your objects using the built-in LINQ. These two features are very useful when you are...
Dondon Vizcayno
How to Dynamically Sort Objects in C# Using Dynamic LINQ
By Dondon Vizcayno on July 15, 2010
Sorting is built-in in the LINQ library, however, you need to use column names and keywords for controlling the direction of the sorting (static). With the availability of the Dynamic LINQ library, you can now sort using strings...
Dondon Vizcayno
How to Render an ASP.NET MVC Partial View to a String
By Dondon Vizcayno on July 15, 2010
Similar to the need of rendering a full view into a string, rendering a partial view is not built-in in the ASP.NET MVC 2 framework. The typical uses of this aside from generating pdf is in returning values to ajax calls. Let us say that...
Dondon Vizcayno
How to Render an ASP.NET MVC View to a String
By Dondon Vizcayno on July 15, 2010
There might come a time when you will need to get a string representation of a view. Currently in the MVC 2 release, this is not built-in. Typical uses of this is in generating pdf files from views. With the view rendered as string, you...
Dondon Vizcayno
HTML Helper for Local Path of Content
By Dondon Vizcayno on July 15, 2010
Similar to the need for getting the absolute url of a link, you might want to know the disk path of a web content. Again, this is not present in MVC 2. You can use the custom HTML helper below to achieve this: public static string...
Dondon Vizcayno
HTML Helper for Absolute URLs
By Dondon Vizcayno on July 15, 2010
There are times when you might need to get the absolute url of content or page in your website. Unfortunately, there are no built-in helpers in MVC 2 for you to do this. You can use the code below to create a custom HTML Helper that...
Dondon Vizcayno
MVC Data Annotations Not Working in Dynamic Forms - and How to Fix them
By Dondon Vizcayno on July 15, 2010
It is observed that in the current release of ASP.NET MVC 2, the data annotations do not work when the form is dynamic, like in the case where it is fetched from the server via JQuery. A typical scenario where this occurs is in modal...
ime.ph © 2010