Javascript hell

In 1997-200x days, when I have been programming in VB3-6 , there was a problem named ”DLL Hell”.

I have been hoping that, with the introduction of .NET, we will escaping this – and I have had my request answered( ok, from .NET 2 )

However, a new problem is for WebDevelopers : JavaScript Hell. Why I am telling that ? Simple :

  1. I have an application that works well in IE 8Star – and uses Json.Stringify to post data. Normally, when I was trying with IE7, it does not work – because JSON.Stringify was not allowed …Of course , solution was adding javascript from .
  2. Same application use jquery 1.4 + 1.1.2 (to can modify dynamically some textboxes) + other js( a date time formatter,jquery ui and others)- . Now , in IE9 RC , jquery1.4 does  not function – and you have to use jquery1.5.1.rc also.Please tell me how to know what modifications the other js files must have( in particular knockout) .

And the mock idea is not solving the issue. You must test either manually , either with an automated test for browser(like Selenium) and testing explicitely in browser version! And I have  speak only about IE, not Firefox and /or Chrome…

If you are a developer, how many javascript do you use? If more than 2 ,welcome to javascript hell!

Star : Please read the requirements from :


Starting with JScript 5.8, by default, the JScript scripting engine supports the language feature set as it existed in version 5.7. This is to maintain compatibility with the earlier versions of the engine. To use the complete language feature set of version 5.8, the Windows Script interface host has to invoke IActiveScriptProperty::SetProperty.

Internet Explorer 8 opts into the JScript 5.8 language features when the document mode for Internet Explorer 8 is “Internet Explorer 8 Standards” mode. For other document modes, Internet Explorer uses the version 5.7 feature set.

JScript 5.8 includes native JavaScript Object Notation (JSON) support and the accessor methods for Document Object Model (DOM) prototypes.

Asp.NET MVC, Jquery and Razor – Cascading dropdown, retrieving partial views, Json send objects, handling errors

There are many blogs and other posts on using jQuery with MVC. You can find individual posts on:

·         How to send objects to an action method via JavaScript.

·         How to retrieve partial views.

·         How to handle errors. mvc jquery razor cascading demo

I have written a sample showing how to do all of these together. The sample is written in  MVC 3 using Razor views

The sample demonstrates:

  1. Cascading dropdown ( see the button Populate from action and Cascading drop down)
  2. Populating a table from a Partial View(see the button Add New Employee(jquery call action and render)
  3. How to handle  error from action ( press Save 2 )
  4. How to send id parameters (long) from javascript to action ( press Delete 1 or Delete 2)
  5. How to send objects(Employee) from javascript to action ( press Save 1 or Save 2)

Without further ado, this is the project . Enjoy!

Jquery MVC Razor demo full

PS: If you seems that the code is too hard, here is a more detailed explanation :

Programmer Sql Server Management settings

Please left click on “Tools (menu item)” in “Microsoft SQL Server Management Studio”
Please left click on “Tools (menu item)” in “Microsoft SQL Server Management Studio”
Please left click on “Options… (menu item)” in “&Tools”
Please left click on “Prevent saving changes that require table re-creation (check box)” in “Options”
Please left click on “Environment (outline item)” in “Options”
Please left click on “At startup: (combo box)” in “Options”
Please left click on “Open Object Explorer and new query (list item)”
Please left click on “Text Editor (outline item)” in “Options”
Please left click on “Transact-SQL (outline item)” in “Options”
Please left click on “Line numbers (check box)” in “Options”
Please left click on “Query Execution (outline item)” in “Options”
Please left click on “Query Results (outline item)” in “Options”
Please left click on “SQL Server (outline item)” in “Options”
Please left click on “SQL Server (outline item)” in “Options”
Please left click on “Results to Grid (outline item)” in “Options”
Please left click on “Include column headers when copying or saving the results (check box)” in “Options”
Please left click on “Multiserver Results (outline item)” in “Options”
Please left click on “Add server name to the results (row)” in “Options”
Please left click on “Page down (push button)” in “Options”
Please left click on “OK (push button)” in “Options”

MVC Zip Result

Sometimes you need to send to the user more than 1 file – or, maybe, the file is too large
The simplest way is : made a zip file that contains the others.

What do you need
1. SharpzipLib from ( or download via NuGet in VS)
2. obtain the file(s) that you want as a string or as a byte[] – let’s say you have a byte[] to store in a str variable
3. make in your action something like that:

 var fcr = new ZipResult("Export.xls", str);
            fcr.AddFile("readme.txt","this zip file contains ..");
            return fcr;

4. copy the following code in your mvc projects:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.IO;
using ICSharpCode.SharpZipLib.Zip;
using System.Text;

namespace utilsResult
    public class ZipResult : FileResult

        private Dictionary<string, byte[]> content = new Dictionary<string, byte[]>();
        public string FileNameZip;
        public ZipResult(string FileName, byte[] Contents)
            : base("application/octet-stream")
            this.FileDownloadName = Path.GetFileNameWithoutExtension(FileName) + ".zip";
            AddFile(FileName, Contents);
        public void AddFile(string FileName,  byte[] Contents)
            content.Add(FileName, Contents);
        public void AddFile(string FileName,string Contents, Encoding e = null)
            if (e == null)
                e = ASCIIEncoding.ASCII;

            content.Add(FileName, e.GetBytes(Contents));

        protected override void WriteFile(HttpResponseBase response)

            using (ZipOutputStream zos = new ZipOutputStream(response.OutputStream))

                foreach (var item in content)
                    ZipEntry ze = new ZipEntry(item.Key);
                    ze.DateTime = DateTime.Now;                    
                    int count=item.Value.Length;
                    zos.Write(item.Value, 0, count);

5. future improvements:
Zip the file(s) in a dll project to made fully testable!

ASP.NET MVC make users–roles fast

please left click on “Microsoft SQL Server Management Studio (push button)”
please create a database in “Microsoft SQL Server Management Studio”
please left click on “C:\Windows\system32\cmd.exe (push button)” and enter the following command : aspnet_regsql.exe -E -S .\SQLExpress -d proprii -A rm
please left click on “ListPanel (list)” in “Microsoft SQL Server Management Studio”
please left click on “Tables (outline item)” in “Microsoft SQL Server Management Studio”
please keyboard input in “Microsoft SQL Server Management Studio” [F5]
please right click on “aspnet_Applications (list item)” in “Microsoft SQL Server Management Studio”
please left click on “Select Top 1000 Rows (menu item)”
please left click in “Microsoft SQL Server Management Studio”
please left click on “aspnet_Users (list item)” in “Microsoft SQL Server Management Studio”
please right click on “aspnet_Users (list item)” in “Microsoft SQL Server Management Studio”
please left click on “Select Top 1000 Rows (menu item)”
please left click on “RdcDAL – Microsoft Visual Web Developer 2010 Express (Administrator) (push button)”
please edit web.config in your MVC application and change the connection string to point to your database
please scroll down until membership and change application name from / to /applicationName
please run your application and left click on “Log On (editable text)” in “Home Page – Windows Internet Explorer”
please left click on “User name (editable text)” in “Log On – Windows Internet Explorer”
please left click on “Register (editable text)” in “Log On – Windows Internet Explorer”
please left click on “User name (editable text)” in “Register – Windows Internet Explorer”
please input your details (I have put mine : ignatandrei)
please see that I am registered to the site
please verify to the database – left click on “Microsoft SQL Server Management Studio (push button)”
please left click in “Microsoft SQL Server Management Studio”
please press [F5] in “Microsoft SQL Server Management Studio”
please see the results – application name
please left click on “Execute (push button)” in “Microsoft SQL Server Management Studio” for the query that lists users.

Programmer retrospective – 2010

What have I done in 2010 ?
1. I started this blog in English( I have one in Romanian, too)

2. I have made a book (outdated) about ASP.NET MVC 2 tips and tricks , published on Amazon .
3. I have initiated a book about programming in VS2010 – alas, it’s in Romanian at

4. I have learned ASP.NET MVC by answering to the questions at 1146 and I have nominated moderator on ASP.NET forums.

5. I have made a project for Azure – it is call “backup” – a project that you can deploy on Azure and have abackup for your files – like Mozy or DropBox . It is here :
(and those are other mine projects on codeplex:

Change Data Capture Helper
IEnumerable – DataTable Exp…
vhd to boot entry
windows azure backup

It was a good year for me!

Hope it was for you too!

Andrei Ignat weekly software news(mostly .NET)

* indicates required

Please select all the ways you would like to hear from me:

You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices here.