Wednesday, August 15, 2012

0x800a139e - Microsoft JScript runtime error: ASP.NET Ajax client-side framework failed to load.

You may encounter this error in MVC applications.
Ajax libraries are rendered to the client side as axd file requests, in turn it actually returns javascript files.
MVC url routing blocks axd files by default.
To avoid this you can add the following line in Application_Start method Global.asax.cs/vb
CS
RouteTable.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
VB
RouteTable.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}")

Saturday, August 11, 2012

Standard Date Time Formatting

Date values can be formatted to particular format using ToString method

 

Example

var str = dt.ToString(“o”)

 

Format Code Sample output Format Name
d 10-08-2012 Short Date
f 10 August 2012 14:20 Full Date Time Short
g 10-08-2012 14:20 General Short
m 10 August Day Month Pattern
o 2012-08-10T14:20:30.1230000 Round trip date time
r Fri, 10 Aug 2012 14:20:30 GMT RFC1123
s 2012-08-10T14:20:30 Sortable date time
t 14:20 Short time
u 2012-08-10 14:20:30Z Universal sortable
y August, 2012 Month Year
D 10 August 2012 Long Date
F 10 August 2012 14:20:30 Full Date Time Long
G 10-08-2012 14:20:30 General Long
M 10 August Day Month Pattern
O 2012-08-10T14:20:30.1230000 Round trip date time
R Fri, 10 Aug 2012 14:20:30 GMT RFC1123
T 14:20:30 Long Time
U 10 August 2012 08:50:30 Universal sortable
Y August, 2012 Month Year

Thursday, August 09, 2012

Extension method must be defined in a non-generic static class

Extension methods (with this keyword in the first parameter), should be containing only within the class is Non Generic and Static.

Containing class

Should Not be generic class

Should be defined as static