Thursday, 29 May 2014

How to create a blank solution in Visual Studio?

Follow these steps to create an empty solution in Visual Studio
  1. On the File menu, click New and then click New Project.
  2. In the left pane, select Installed, select Other Project Types, and then select Visual Studio Solutions from the expanded list.
  3. In the middle pane, select Blank Solution.
  4. Set the Name and Location values for your solution, then click OK.

Monday, 19 May 2014

X-Frame-Options response header

The X-Frame-Options HTTP response header can be used to indicate whether or not a browser should be allowed to render a page in a <frame>, <iframe> or <object> . Sites can use this to avoid clickjacking attacks, by ensuring that their content is not embedded into other sites.

Using X-Frame-Options

There are three possible values for X-Frame-Options:

  • DENY

    The page cannot be displayed in a frame, regardless of the site attempting to do so.

  • SAMEORIGIN

    The page can only be displayed in a frame on the same origin as the page itself.

  • ALLOW-FROM uri

    The page can only be displayed in a frame on the specified origin.

Read More>>

What is clickjacking?

What is Clickjacking and How can you prevent it?

Modifying multiple CSS properties in one go using jQuery

jQuery .css() method can be used to set one or more CSS properties for every matched element.

Setting single CSS property
 
$('p').css( "background-color", "yellow" );

 

Setting multiple CSS propertes
 
$('div.header').css({"background-color": "yellow","font-weight": "bold" });

 

Read More

jQuery API - .css() Method

www.w3schools.com >>jQuery - css() Method

Thursday, 8 May 2014

Accessing radio button state using jQuery

You can use the .is(selector) function in jQuery to get the state of a radio button.

Example:

$("#radiobuttonid").is(":checked")

$('input[id="group1"]').is(':checked') 

Also

$("#radiobuttonid").attr("checked", true)
sets the state of the radion button to selected.

Monday, 5 May 2014

ASP.NET MVC Versions and Features

ASP.NET MVC1

Released in Mar 2009, Runs on .Net 3.5 / Visual Studio 2008, WebForm View Engine, Html Helpers, Ajax Helpers, Routing, Unit Testing

ASP.NET MVC2

Released in Mar 2010, Runs on .Net 3.5 / Visual Studio 2008 & .Net 4.0 / Visual Studio 2010, Strongly typed Html Helpers i.e. lambda expression based Html Helpers, Data Annotation Attributes, Client-side validation, UI helpers with automatic scaffolding & customizable templates, Attribute-based model validation on both client and server, Asynchronous controllers

ASP.NET MVC3

Released in Jan 2011, Runs on .Net 4.0 / Visual Studio 2010, Razor view engine, ViewBag dynamic property for passing data from controller to view, Global Action Filters, Better JavaScript support with unobtrusive JavaScript, jQuery Validation, and JSON binding, Improved Support for Data Annotations, Remote Validation, Compare Attribute, Partial-page output caching, Sessionless Controller, Child Action Output Caching, Dependency Resolver, Entity Framework Code First support, Use of NuGet to deliver software and manage dependencies throughout the platform, Good Intellisense support for Razor into Visual Studio

ASP.NET MVC4

Released in Aug 2012, Runs on .Net 4.0, 4.5 / Visual Studio 2012, ASP.NET Web API, Enhancements to default project templates, Mobile project template using jQuery Mobile, Display Modes, Task support for Asynchronous Controllers, Bundling and minification, Support for the Windows Azure SDK

ASP.NET MVC5

Released in Oct 2013, Runs on .Net 4.5, 4.5.1 / Visual Studio 2013, ASP.NET Web API2, One Asp.Net, Asp.Net Identity, ASP.NET Scaffolding, Authentication filters - run prior to authorization filters in the ASP.NET MVC pipeline, Bootstrap in the MVC template

Click here to read about C# Versions and features

Using ViewBag in _ViewStart.cshtml

Trying to set or get some value to/from ViewBag in _ViewStart.cshtml will throw an error when you run the app. There is a workaround for this using ViewContext.Controller.ViewBag.

Here is some sample code

ViewContext.Controller.ViewBag.StoreName = "My New Store";

...

@ViewContext.Controller.ViewBag.StoreName

Read more >>

ViewData mechanics and segmentation