How to enable and disable optimizations in ASP.NET MVC?

You can enable and disable optimizations by setting EnableOptimizations property of BundleTable class to true or false with in Global.asax.cs file as shown below. protected void Application_Start() { //other code has been removed for clarity //disable optimization System.Web.Optimization.BundleTable.EnableOptimizations = false; }  

What are Styles.Render and Scripts.Render?

Style.Render is used to render a bundle of CSS files defined within BundleConfig.cs files. Styles.Render create style tag(s) for the CSS bundle. Like Style.Render, Scripts.Render is also used to render a bundle of Script files by rendering script tag(s) for the Script bundle. public class BundleConfig { public static void… Continue reading

What are RenderBody and RenderPage in ASP.NET MVC?

RenderBody method exists in the Layout page to render child page/view. It is just like the ContentPlaceHolder on master page. A layout page can have only one RenderBody method. <body> @RenderBody() @RenderPage(“~/Views/Shared/_Header.cshtml”) @RenderPage(“~/Views/Shared/_Footer.cshtml”) @RenderSection(“scripts”,false) @section scripts{ <script src=”~/Scripts/jquery-1.7.1.min.js”></script> } </body> RenderPage method also exists in the Layout page to render… Continue reading

What are Layouts in ASP.NET MVC?

Layouts are used to maintain a consistent look and feel across multiple views within ASP.NET MVC application. As compared to Web Forms, layouts serve the same purpose as master pages, but offer a simple syntax and greater flexibility. A basic structure of layout is given below: <!DOCTYPE html> <html> <head>… Continue reading

What is Cross Domain AJAX?

By default, web browsers allows AJAX calls only to your web application’s site of origin i.e. site hosted server. This restriction help us to prevent various security issues like cross site scripting (XSS) attacks. But, sometimes you need to interact with externally hosted API(s) like Twitter or Google. Hence to… Continue reading

What are various configuration options for AJAX Helpers?

The AjaxOptions class defines properties that allow you to specify callbacks for different stages in the AJAX request life cycle. There are following properties provided by AjaxOptions class for AJAX helpers: Property Description Url Specify the URL that will be requested from the server. Confirm Specify a message that will… Continue reading

What are AJAX Helpers?

AJAX Helpers are used to create AJAX enabled elements like as Ajax enabled forms and links which performs request asynchronously. AJAX Helpers are extension methods of AJAXHelper class which exist in System.Web.Mvc namespace. AJAX HTML Element Example AJAX-enabled link based on action/controller @Ajax.ActionLink(“Load Products”, “GetProducts”, new AjaxOptions {UpdateTargetId = “Products-container”,… Continue reading

What is Validation Summary?

The ValidationSummary helper displays an unordered list of all validation errors in the ModelState dictionary. It accepts a boolean value (i.e. true or false) and based on boolean value it display the errors. When boolean parameter value is true, it shows only model-level errors and excludes model property-level errors (i.e any… Continue reading