My Technology Reference

jQuery click event handler doesn’t work – use live :)

Posted in Microsoft .Net, Web by DK on February 22, 2011

If you are trying to use jQuery .click() event handling on dynamically added elements/controls, you might notice something that looks like click event never getting fired. This happens because click handler gets set on current set of elements only. For dynamic elements you have to use something that handles future elements as well.

When I saw it first time, I thought I found a bug in either jQuery or browser or both. Anyways, this particular case is not a bug.

Answer is using .live().


$("#ID").live("click", function() {
// Handler code
Tagged with: ,

ASP.NET MVC, jQuery, JSON and jTemplates example

Posted in Microsoft .Net, Web by DK on August 31, 2010

I recently tried MVC, jQuery, JSON and jTemplates on a test project. When combined together these technologies can be very powerful. Here is the example –

I was using:


using System;

namespace MvcApplication1.Models
    public class Employee
        public Guid Id { get; set; }
        public string Name { get; set; }
        public string Title { get; set; }
        public DateTime CreatedOn { get; set; }
        public DateTime? UpdatedOn { get; set; }


using System;
using System.Collections.Generic;
using System.Web.Mvc;
using MvcApplication1.Models;

namespace MvcApplication1.Controllers
    public class HomeController : Controller
        public ActionResult Index()
            return View();

        public JsonResult Index(string SortBy)
            var result = new List<Employee>
                new Employee
                    Id = Guid.NewGuid(),
                    Name = "Employee 1",
                    Title = "Title 1",
                    CreatedOn = DateTime.Now,
                    UpdatedOn = DateTime.Now
                new Employee{
                    Id = Guid.NewGuid(),
                    Name = "Employee 2",
                    Title = "",
                    CreatedOn = DateTime.Now,
                    UpdatedOn = DateTime.Now
                new Employee{
                    Id = Guid.NewGuid(),
                    Name = "Employee 3",
                    Title = "Title 3",
                    CreatedOn = DateTime.Now,
                    UpdatedOn = null

            return Json(result);


<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Home Page
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script src="../../Scripts/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery-jtemplates.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
                url: "/Home/Index",
                type: "POST",
                dataType: "json",
                data: {
                    SortyBy: ""
                success: function (result) {
        function JsonStrToDtStr(jsonDate) {
            if (jsonDate == null) return "";
            var dt = new Date(parseInt(jsonDate.replace("/Date(", "").replace(")/", ""), 10));
            return (dt.getMonth() + 1) + "/" + dt.getDate() + "/" + dt.getFullYear();
    <!-- Result gets injected here -->
    <div id="employees">
    <!-- Template for Employees -->
    <p style="display: none">
        <textarea id="employeetemplate" rows="0" cols="0"><!--
                    <td>Created On</td>
                    <td>Updated On</td>
			{#foreach $T as employee}

Browsereimer- a brain disorder that interferes with browser pick

Posted in Web by DK on July 18, 2010

I think I am suffering from Browsereimer (a brain disorder that interferes with decision making of which browser to use for what).

I have installed all different browsers. Each browser has some unique features and need. But now I get confused on which browser to use for what purpose. Here is the list of browsers and the usefulness. I will refer to this list if feel confused again:

  • IE – SharePoint and for the websites which are not there yet
  • Firefox – almost everything, this is the primary browser
  • Chrome – For the sites I don’t want to mix with Firefox bookmarks, history, passwords etc
  • Flock – Social networking, blogging etc
  • Safari – Once in a while for better graphics
  • Lunascape – Not using anymore
  • SeaMonkey – I really don’t know whats the use for this one
Tagged with: , ,

ASP.Net MVC form post FormCollection contains no key or missing some keys

Posted in Microsoft .Net, Web by DK on July 8, 2010

I recently ran into an issue where FormCollection didn’t have any key.

This happens when you are using

  • html controls (not generated via mvc html helper) and
  • you didn’t assign value to name attribute to one or more controls.

Add name attribute to the html control, as rule of thumb keep value of name attribute same as id attribute. This should solve the issue.

Tagged with: , , ,

Applications / tools for a developement (and personal use) machine

Posted in Microsoft Windows by DK on May 12, 2010

This is a list of helpful applications / tools for a development machine (.Net primarily and others). I am creating this list for my future reference. They should be installed in the order listed.


  1. Internet Explorer 8 (built-in with the Windows)
  2. Opera latest (
  3. Firefox latest (
  4. Safari latest (
  5. Chrome (
  6. Flock (
  7. Add-ons (Useful Firefox add-ons for web developers)


  1. .Net frameworks (use Visual Studio installations)
  2. Ruby on Rails (


  1. Microsoft Visual Studio 2008 (from msdn)
  2. Microsoft Visual Studio 2010 (from msdn)
  3. RadRails (for RoR) (


  1. Microsoft Sql Server 2008 (from msdn)
  2. MySQL
    1. Community Server (
    2. Workbench (
  3. IBM DB2
    1. .Net client
    2. Data Studio
  4. Oracle
    1. ODP.Net

Source Control

  1. Microsoft Visual SourceSafe client (from msdn)
  2. Perforce Visual Client (P4V) (
  3. TortoiseSVN (
  4. TortoiseHg (for Mercurial) (


  1. Yahoo! Messenger (
  2. Google Talk (
  3. Skype (

Essential Utilities

  1. SlickRun (
  2. 7-Zip (
  3. PDF
    1. Foxit Reader (
    2. Foxit PDF Editor (
  4. Textpad (
  5. Microsoft Office 2007 (from msdn)
    • Outlook
    • Visio
    • OneNote
    • Word
    • Excel
    • Access
    • PowerPoint
  6. Cobian Backup (
  7. TeamViewer (


  1. Microsoft Virtual PC (from msdn)
  2. Tor Browser Bundle (
  3. Google Earth (
  4. BlackBerry Desktop Software (
  5. VLC media player (
  6. DivX Plus Player (

I am sure there are more, but that is all I can think of as of now. After looking at the list above, I wonder why I complain about my machine being slow 🙂

EASEUS for partition management

Posted in cleanup by DK on May 9, 2010

Recently, I was ready to install Visual Studio 2010 on my Windows XP machine and realized I was running low on my C:. Unfortunately VS10 uses lot of C: even if you tell it to install on D:, I assume it installs lot of shared files on same drive as Windows.

Anyways, I wanted to move some free disk space form D: to C:. XP doesn’t have any built-in tools for this. However, I found this amazing tool EASEUS Partition Master Home Edition for free, which helped me finish the task.


  • Download EASEUS from
  • Start EASEUS Partition Master from Start -> All Program. Once it start it should show all drives on your machine
  • Click on D: and click Resize/Move from top buttons
    • EASEUS Menu
  • Use slider button on left under Size and Position to free up some space before D:. While are you clicking on slider you should numbers changing in Unallocated Space Before box. This shows how much space you will freeing up
    • resize
  • Click OK
  • Now select C: and click Resize/Move
  • Use slider on the right to increase space of C: and click OK
  • You are ready to apply changes to your disk. Click Apply in left side panel
  • This may require one or two reboots. Check your drives after reboots are done and magic is done

Great job EASEUS. You made my day!!!

Improve Windows XP computer performance

Posted in cleanup, Microsoft Windows by DK on May 2, 2010

When you get a fresh computer, it runs like a charm. As you use it more and more and keep installing different software, performance goes down the hill. My Windows XP machine took 15 minutes to just bootup which was very annoying. I finally decided to do some cleanup. Try the following to improve performance little bit:

RAM Usage

Here is some registry tweaks to improve RAM usage. Open registry editor and go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management. Change following keys:

Unused applications

There might be lot of applications you don’t use anymore but do not realize are still installed on your machine.

  • Go to Start -> Run, type appwiz.cpl, click OK
  • Go through the list and remove all unused applications

Installshield Software Manager

Update service of software manager was set to run at startup on my machine. I don’t think may software providers use this installer anymore.

Uninstall by running Update Manager uninstaller (ref: Installshied KB Q111006)

MsConfig startup

  • Go to Start -> Run, type msconfig, click OK
  • Click on Startup tab
  • All applications listed here start when computer boots up, uncheck applications you don’t need to start at each boot and click OK. For information regarding applications listed, go to Paul Collins’ Startup Applications List

Run keys

  • Open Registry Editor (Start -> Run, type regedit, click OK).
  • Go to key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run.
  • You will see some entries out there. All applications listed here start when computer boots up, delete unwanted apps. Its very safe and doesn’t impact your application. However some apps (e.g. Installshield) would add this key back when you run the app next time or get an update. If that happens, you need to find better steps (e.g. Update Manager uninstaller above).

Start menu startup

  • Go to Start -> All Programs -> Startup.
  • Applicaitons listed here start when computer boots up, delete as needed. Agains its very safe.

I will add as I do more cleanup on my box.

Tagged with: , ,

Umbraco installation

Posted in Web by DK on April 27, 2010

Alright, getting started with Umbraco. Installation was easier than I thought and read on some reviews. Their wiki can be arranged little better than current state, but hey its open source.

I am planning to use MySql for the project, which was already installed on my machine. I chose to go with MySql over MS Sql Server as I like the “free” feature. MS Sql Express is free as well but I don’t think its close to MySql. Being said that Umbraco supports MySql out of the box.

Out of all steps on Umbraco Install and setup wiki, I just had to follow these steps for installation:

Very simple, above two steps plus Umbraco cofiguration/installation steps once you can hit default.aspx page and you are running a basic Runway webpage (however, its almost blank :), at least to me).

Once you start playing around and close browser windows by mistake, you might wonder where to go.

New website choices

Posted in Web by DK on April 26, 2010

I am thinking of creating a website for fun, which I hope might attract some users out there. I might get chance to try different things during the journey. When you try to create some new website and want to figure out what latest tools to use, it gets confusing. I found lots of options, out of which I tried to explore some of them.

Here are the custom website options I considered:

  • ASP.Net webforms – would be pretty standards choice for me. But I have been doing lots of webforms already, and while its great, I wanted to try something different which might require less coding
  • ASP.Net MVC – there is a new hype around MVC. Its definitely very interesting and totally different approach than webforms. This requires some custom coding, and lot more than webforms, which I am trying to avoid
  • Ruby on Rails – has drawn my attention recently. Its very interesting MVC based approach for web application, and gives some in-built support for repetitive tasks. But after doing the demo, it seemed like a big learning curve and I would go with ASP.Net MVC over RoR. However, if I had spent enough time learning RoR, it would have been choice over .Net

So much for the custom sites, I have been creating them for last few years. I thought its time to build on something that’s already built. Which took me to content management system (CMS). I decided to stick with .Net based cms as thats the platform I am comfirtable with, however, there are some very good non .net choices out there. My CMS considerations:

  • DotNetNuke – read some reviews saying its heavy. Its written in VB.Net, which was a downer as well.
  • mojoPortal – is very simple to implement. Seems it doesn’t require a developer to create a site and I don’t when its that easy
  • Umbraco – is as good as mojoPortal. Read reviews that its more complex than mojoPortal but gives more flexibility. I am going to go with this option (at least as of now)

There are some other .Net CMS available as well, but from quick research above ones seemed better than others. Here are some good places which helped me a lot in making a decision (and there were some others I couldn’t keep track of). Thanks to all writers, bloggers and commenters.

Next steps – I am going to start learning and using Umbraco. I will blog a word or two about the steps, progress and experience as I go.

Trying new browsers

Posted in Web by DK on April 25, 2010

These two new browsers have caught my attention

  • Flock – this is a social web browser. You can access lot of your social websites, blog engines, photo sharing from one place. You can directly upload photos, blog etc from this browser without using website.
  • Lunascape – this browser has multiple engines. You can switch to FF or IE on the fly. You can also designate engine by the websites to get best web experience. I think it gives best of both FF and IE.


Some updates on this. Flock is now my social web browser. I have given up on Lunascape, its still not there yet. Its slow and UI is cluttered for easy use, may be I will if they get better in future versions.

Another browser I am trying now is Opera. After not much enjoying Opera Mini on blackberry, I was not that much excited. But as I have used almost all major browsers in the market except Opera, I felt obligated. They claim to be “Fastest browser on Earth”. It has best interface out of all other browsers I have been using or tried. I won’t call it the fastest browser though, chrome sees to have an edge on that part. But overall it has great potential and I am liking it.

Tagged with: , , ,