Wednesday, March 31, 2010

ReorderList in AJAX .NET Control Toolkit Requires ClientIDMode="AutoID"

When using "ReorderList" from AJAX .NET Control Toolkit, I found that it has a "hidden requirement": its "clientIDMode" attribute must be set to AutoID.

If you look at the AJAX .NET Control Toolkit sample website, its ReorderList sample does not have this attribute set. But the ReorderList sample works fine. How is that possible? It is because this sample site has "clientIDMode="AutoID" set in its web.config file:


<system.web>

...

<pages ... clientidmode="AutoID">

...

</system.web>


In other words, all controls in this sample website have this attribute set automatically!

What happens if you do not have this attribute set on a ReorderList control? Well, you will not be able to drap and drop items to reorder them. If you look at the HTML code that is generated, the "_behavior" attributes that are supposed to go to each "li" element in the item list all get piled onto a single "div" element on the outside, along with the "DraggableListItem" attribute. So when you try to drag an item in the list, you will either get no response, or a stop-sign icon.

Friday, March 12, 2010

Running Remote Desktop Connection in XP Mode of Windows 7

Many VPN clients would lock up network connection so that all traffic goes to the VPN gateway. You cannot browse the internet or make other internet connections from your computer without going through the VPN gateway.

To get around this restriction, we can use Windows 7's XP mode. We can run the VPN client and a remote desktop connection on Windows 7's desktop from the XP mode virtual machine. The XP mode virtual machine will then hold the exclusive connection to the VPN gateway.

However, setting up such an arrangement is far from easy. Normally, if you go into the XP mode virtual machine, and add a shortcut to a program in the folder
\Document and Settings\All Users\Start Menu\Programs,
the shortcut will show up in the Windows 7 host's start menu under "Windows Virtual PC", "Windows XP Mode Applications".

This does not work for Windows XP's Remote Desktop Connection. If you add a shortcut to \Windows\system32\mstsc.exe in that folder, the shortcut does not show up in the Windows 7 host's start menu.

There are a couple of suggestions on the internet that can fix this: one is to create a batch file that calls \Windows\system32\mstsc.exe, and then add a shortcut to this batch file in the folder
\Document and Settings\All Users\Start Menu\Programs
The other involves editing the shortcut file on the Windows 7 host.

I would like to offer another alternative. If you save your connection to another machine in a .rdp file, you can create a shortcut to this file in
\Document and Settings\All Users\Start Menu\Programs,
and this shortcut does show up in the Windows 7 host's start menu.

However, Windows XP's Remote Desktop Connection does not work well on Windows 7 host's desktop. It shows two windows for one. One is a local input capture window, and one is the remote desktop. When you minimize the remote desktop, the local input capture window stays, and cannot be hidden easily.

The solution is to install a Windows 7 virtual machine. The Windows 7 virtual machine can integrate with the Windows 7 host the same way as a XP mode virtual machine. The path for the shortcut is a little different. It is \ProgramData\Microsoft\Windows\Start Menu\Programs, not \Document and Settings\... as it is under XP mode virtual machine.

The virtual Windows 7's Remote Desktop Connection works flawlessly on the Windows 7 host's desktop.

Please note that you must install VPN client in the virtual machine, and you may need to run the VPN client from the Windows 7 host's start menu before starting the Remote Desktop Connection from the same menu folder.