Using TextBoxes in AJAX Web Pages

This is a cautionary note for web developers using the Microsoft ASP.Net AJAX framework and the AJAX Control Toolkit.

Imagine this scenario: you have a web page where the user picks a date from a calendar, then you use that date to select a set of records from a database to display in a table on the same page. Fairly straightforward, you would have thought.

The calendar comprised of a TextBox and the CalendarExtender from the AJAX Control Toolkit. On selecting a date in the calendar, the value is displayed in the TextBox. This would trigger a postback which would allow me to grab the date and use it to retrieve the records from the database.

No matter what I tried, the postback was not being triggered. After much research, I finally got it working but was surprised to discover that the root cause of the problem lay with the TextBox:

Code Snippet
  1. <asp:TextBox ID="txtSelectedDate" ReadOnly="true" />

Apparently, if a TextBox is set to be read-only, then it does not fire an OnTextChanged event on postback.

The solution was to remove the read-only attribute and use client-side JavaScript to prevent the TextBox from being edited.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Windows 7, XP Mode and Sony VAIO

One of the more widely publicised features of Windows 7 is the new “Windows XP Mode”, which is a Virtual Machine running Windows XP.

The virtual machine allows you to run older applications that might not work on Windows 7 and is an attempt by Microsoft to address some of the application compatibility issues that plagued Windows Vista.

My wife owns a Sony VAIO laptop which I successfully upgraded from Windows Vista Business to Windows 7 Professional. Previously, she had been running Microsoft Virtual PC SP1, which had to be uninstalled prior to the upgrade.

After downloading and installing Windows XP Mode and Windows Virtual PC, I fired up the virtual machine only to get an error message saying that the virtual machine requires hardware-assisted virtualization to be enabled in the computer’s BIOS. This allows the virtual machine to access the physical hardware of the host machine instead of emulated hardware.

The Sony VAIO contains an Intel Core 2 Duo processor, which I know for a fact supports hardware virtualization, but could I find an option to enable it in the BIOS menu? No. A quick web search revealed that the reason for this is that Sony has disabled the hardware virtualization option from appearing in the BIOS menu!

This has caused much frustration and anger amongst VAIO owners. Sony has steadfastly refused to release BIOS patches to enable the option in affected models, though they have committed to enabling it in future models.

I think this is a very poor response from Sony. Such a respected brand ought to be careful of alienating its customers in this way.

Note: Windows XP Mode is available as a separate download from Microsoft’s website and runs on the Professional and Ultimate editions of Windows 7 only.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Karate Success

Earlier this year, in an effort to get fitter, I took up karate again after a ten-year absence.

I’ve really got back into it and enjoy it very much. So much so, that last weekend, I took part in my first karate competition - the TISKA (Traditional International Shotokan Karate Association) National Championships, held in Kettering, Northamptonshire.

There were about 200 participants representing TISKA clubs from all over the country. We were divided into groups of roughly equal grade - I was in a group of about 14 yellow, green (my grade) and purple belts.

First, we had to perform kata; a kata is set sequence of moves which gets progressively more complex with each grade. Kata is performed in pairs in front of three judges. In my first round match, I did Heian Shodan, but in subsequent rounds it was Heian Nidan, one of my favourite katas. I was delighted when the three judges’ flags went up in my favour.

KarateSmallNext, it was kumite, or sparring. Again, we were divided into groups of the same grade, but this time there were only 13 of us in our category. I had to fight four times. Each fight lasted for two minutes, but it felt longer.

In kumite, points are awarded for hitting your opponent. If you score a total of 2 points before the time’s up, the match is over immediately. If, at the end of the match, the scores are equal, the fight continues until whoever scores next.

I had to fight four times. I can barely remember what happened in each fight, but I remember my second round match ended in a draw and then continued for what seemed like ages until I eventually scored the winning point. The referee then informed me that I was in the semi-final, but they were going to do the second semi-final first, to give me time to recover.

In my semi-final match, I was briefly knocked to the ground when my opponent’s mitt caught me on the cheekbone. In the same fight, I hurt my left hand when I went in for a gyaku-tzuki (reverse punch) and my fingers bent backward  too far – ouch!

In the final, I was up against a purple belt, the next grade up from mine. He scored first, and though I got a point back, he scored again with just seconds to spare!

It was good experience, and highlighted several areas where I need to improve.

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5