Server/Client Javascripting, and Windows SDK Shipped (Party Time)

One of my most productive days yet! The file input window is finished, properly storing valid files in sessions, and I've started moving the main data entry form away from server-side MultiViews and autoPostback controls and back to old-school client-side javascript. I think the tool will end up having a more polished look. Attributes.Add and ClientID are your friends when doing this.

Here's an example, in which a data-bound server-side combo box gets an extra client-side event handler assigned, that shows or hides table rows containing content that is unique to the selected item in the combo box. It took me a while to track down the use of style.display instead of style.visibility (which left lots of whitespace).

//On the server side...

protected void Page_Load(object sender, EventArgs e)
//Add the client-side event for changing the content type.
this.ContentType.Attributes.Add("onchange", "HideShowDetailRows();");

//On the client side, when the users select a new content type...
function HideShowDetailRows()
   //Store the Content drop-down control, and the selected item's text.
var ContentDDL = document.forms[0].<%=ContentType.ClientID%>;
   var ContentType = ContentDDL[ContentDDL.selectedIndex].text;

//Show or hide the rows of the table related to the selected content, based on if the item text starts with predefined strings.
//It may seem odd to be databinding the combo box if we know what options there are... but we databind to get the IDs from the database. (ContentType.indexOf("Tools") == 0) ? "block":"none"; (ContentType.indexOf("Binaries") == 0) ? "block":"none"; (ContentType.indexOf("Samples") == 0) ? "block":"none"; (ContentType.indexOf("Documentation") == 0) ? "block":"none";

Party Time
Today we celebrated the newest release of the Windows SDK. There were alcoholic and non-alcoholic drinks available in a hallway nook for an hour or so, and everyone gathered around to chat. Earlier in the day, I was feeling really good about my work and wanted to take a break; towards that end, I had polled for ping pong players and had received replies from around 6 people! It looks like it hasn't been a frequent activity, but that people were willing to try it out again. So during the social, three of us headed upstairs to play for a while.

Side trip: I got into ping pong on my last team. Having never played before, everyone was happy to "teach" me (i.e. I lost a lot :). A year or two passed, and I improved quite a bit. The last year, though, our manager informed us [writers] that we had to refrain from playing ping pong during ship mode, as we had a lot to do and it wouldn't be viewed favorably if we were seen recreating (believe it or not, there can be quite a bit of politics at Microsoft, varying team-to-team and group-to-group). Well, that hiatus lasted for over a year and two ship cycles (and is still in effect, I believe). At any rate, now I'm in a different team, so it looks like my occasional ping-pong-playing can resume! Note that, as always, you have to be professional about it; just because activities are available for taking a break doesn't mean you should use them to detriment of work.

When we came back, a few guys were playing hallway hockey game. Most everyone had headed home. Which I am too... have a great weekend!