Testing in IE

Testing in IE can be horrific process, especially when you have IE 9 and everyone else have IE 8, 7, or the devil it self IE 6. Fear not tho! There is an awesome tool available to help with testing your product in IE… I can go on an epic rant about how ridiculous this testing process can be…  but, I’m not.

Check it out, it is called: >>>DebugBar <<< and also >>> IETester  <<<

Hope it is helpfull!


This is silly, each browser Culture (‘en-US’ or ‘en-CA’) define dates differently

I have a function call to a stored procedure, and it kept failing (exception thrown: Invalid Value NVARCHAR). After rigorousness testing I found that browser Culture is to culprit. I found that “en-CA” date format was different from “en-US“. The “en-CA” was sending the wrong date format to my stored procedure thus it kept failing.

en-CA“: 14/04/2011
en-US“: 4/14/2011

So here is a fix, this can be global (BasePage.cs) or just for a single page (page.aspx.cs).

protected override void InitializeCulture(){
  CultureInfo cultureInfo;

  // Set cookie to "en-US" lang culture
  if (Session[WebConstants.LANGUAGE] == null){

    string cookieLang = myCookies.GetLanguage(Request);
	if (cookieLang == null || cookieLang == ""){
       cultureInfo = new CultureInfo("en-US", true);
    } else {
	   cultureInfo = new CultureInfo(cookieLang, true);

  } else {

    cultureInfo = new CultureInfo((string)Session[WebConstants.LANGUAGE], true);


  Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
  Thread.CurrentThread.CurrentUICulture = cultureInfo;
  currentCultureName = cultureInfo.Name;


Best practice is to use a cookie to remember your language preference.

Jquery 1.5.2 & Json

I upgraded my Jquery from 1.3.2 to 1.5.2 and all of a sudden my $.ajax{} calls stopped working:
It looked something like this:

    type: "POST",
    url: "URL",
    data: "date id : date param",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (data) {
    error: function error(jqXHR, textStatus, errorThrown) {
         console.log("jqXHR: " + jqXHR + "\n" + "Text Status: " + textStatus + "\n" + "Error Thrown: " + errorThrown);

The error I got was:

jqXHR: [object Object]
Text Status: parsererror Error Thrown:
jQuery152012837810831775243_1302731642482 was not called

invalid label {"d":"\u003c?xml version=\"1.0\" ncod...r\n\u003c/ArrayOfFutureBooking\u003e"}

After a day of reading about $.ajax and json, I found that jQuery’s Validation plug-in is not compatible with jQuery 1.5. However after updating jquery.validation I still got the

invalid label

error. I did find an alternate solution, it feels a bit hacky, but works tho!

In the jquery1.5.2.js find the line:

d.ajaxPrefilter("json jsonp", function (b, c, e)
and change to 
d.ajaxPrefilter("jsonp", function (b, c, e)

That works, and all of my $.ajax functions are happy again.

Using alert()s is a bad idea!

When I debug JavaScript I use a combination of firebug and alert()s. The problem is when dealing with a thousands of lines of JavaScript eventually, I ‘might’ forget to remove an alert(). You can only image what happens when the .js is pushed live..

So to prevent an alert() from disrupting your clients, use:

console.log(“something” + someData.d);

This will write to your firebug console.


%d bloggers like this: