Tips & Tricks on ASP.NET MVC, Ajax, jQuery, Entity Framework

Entries for the ‘Tips & Tricks’ Category

Column Attribute in Entity Framework 5

When developing applications using Entity Framework code first approach, you may use Column data annotation on your model properties to define what attributes that property has, ex : name, type etc. in Entity Framework 4.3.1,  ColumnAttribute is defined in System.ComponentModel.DataAnnotations namespace which is available in EntityFramework.dll. So you need to add a reference to EntityFramework.dll and include a using [...]

ASP.NET MVC How to get Model Error details in Controller Action Method When ModelValidation fails

When Working with MVC Model Validations, You may come across a situation where you think you filled all the Required Items in the Form and submitted, but still the ModelState.IsValid property is returning false. I came across this scenario once when i was inherting  a ViewModel from another ViewModel. How do we know what is [...]

How to Convert DataTable to Collection of Custom Class object

Imagine you have a DataTable with Records and you want to Convert that to a List of your Custom class objects ? how do you do that ? The normal -straight forward way is to Loop through  each DataRow, Create a new instance of Custom class object, read the column values of the current row(iterator) [...]

WebImage.Resize method – How to Remove the Left and Top border from the image

WebImage is a class in System.Web.Helpers  namespace ( in System.Web.Helpers dll) which helps us to do some useful things with an image in a webpage like cropping, resizing,flipping ( vertical & horizontal), rotating etc… It is a very useful class if you are working with some code which returns an image  according to your needs [...]