Sunday, May 11, 2014

Disable model validations while submitting the form in MVC

Add below line in the top of the view.
@{
           Html.EnableClientValidation(false);
    }

Friday, March 28, 2014

No exports were found that match the constraint :ContractName Microsoft.VisualStudio.Utilities.IContentTypeRegistryService


Issue description : 

No exports were found that match the constraint:ContractName
Microsoft.VisualStudio.Utilities.IContentTypeRegistryService
RequiredTypeIdentity
Microsoft.VisualStudio.Utilities.IContentTypeRegistryService

Solution : removing all the files from following visual studio ComponentModelCache folder

COMPONENT MODEL CACHE folder location : C:\Users\{YourUserName}\AppData\Local\Microsoft\VisualStudio\11.0\ComponentModelCache

Friday, February 28, 2014

LESS : Dynamic CSS language

Recently come across the using LESS in one of my project. LESS looks very cool and provides the programming capabilities to CSS. Like using LESS in CSS, we can define variables, functions and much more and reuse them across the multiple css pages.

By default every CSS page is a less page.

We can achieve the LESS in a project in two ways.
1.Client side.
2. Server side.

Client side: It will costs the performance cost. Because when ever user requests a page browser needs to convert css file to LESS.

Server Side : when you add the LESS the less at server side it will automatically converts the CSS to LESS while building the application.

You can download the "dotless" package from Nuget.

For more Information, Please refer below reference urls

LESS -> http://lesscss.org/
LESS in dot net -> http://www.dotlesscss.org/

HAPPY CODING :)

Sunday, January 19, 2014

How long the view location will be cached in MVC?

The default cache is 15min.

we can extend this using follwing code in Global.asax


var viewEngine = new RazorViewEngine
                         {ViewLocationCache = new DefaultViewLocationCache(TimeSpan.FromHours(24))};
    ViewEngines.Engines.Clear();
    ViewEngines.Engines.Add(viewEngine);