A reason to celebrate!

October 6th, 2007

This is huge news.  By popular demand Microsoft is releasing the source code for the v3.5 release of the .net framework.  This is a great move by Microsoft and provides users a reason to upgrade immediately.

http://weblogs.asp.net/scottgu/archive/2007/10/03/releasing-the-source-code-for-the-net-framework-libraries.aspx

Posted in General | No Comments »

.NET 2.0 Control Rendering

March 8th, 2007

In the movie Rounders Mike McD said “Listen, here’s the thing. If you can’t spot the sucker in the first half hour at the table, then you ARE the sucker” and in this case I am the sucker!

After upgrading one of our .net 1.1 applications to 2.0 I ran into a very serious problem.  The .net framework started naming all of the controls differently as it rendered them:

‘_ctl1_yourControl’ became ‘ctl01_yourControl’

and in some cases even the number in the ID changed:

‘_ctl1_yourControl’ became ‘ctl02_yourControl’

The weirdest case that I have seen is when a control renders with a different name on the same page on different loads. On one load

‘_ctl1_yourControl’ became ‘ctl04_yourControl’

and on another page load:

‘_ctl1_yourControl’ became ‘ctl05_yourControl’

The name change really isn’t a big deal unless you are a sucker like me and went ’all in’ with javascript throughout the application.  Our code was littered with all kinds of javascript.  These types of lines were everywhere

var textBox = document.getElementById(“ctl4_yourControl”);

Hours were spent renaming all of the controls inside the javascript, but that still didn’t solve the issue of the controls being named differently on subsequent page loads.  This became quite an issue until I found a posting on a message board suggesting that instead of hard coding all of the rendered control names making use of the ClientID property of each control.  This assures that no matter what name the framework gives each control it will always be named properly in the javacript.  Following this advice I changed all of hardcoded control names and everything seems to be working great again.

The new lines now look like this:

var textBox = document.getElementById(“<%= yourControl.ClientID %>”);

This technique can also be useful in the code behind as well when attaching javascript to a control:

control.Attributes.Add(“onClick”,“JSFunc(’”+control.ClientID+”‘)”);

By making use of the control.ClientID property control names never have to be hardcoded in javascript again!

Later!
Pat

Posted in General | No Comments »

A Day in the Life!

March 8th, 2007

Hey All! For my first blog I thought that I would describe a typical day for me working as a consultant (for CityTech, Inc.) in Chicago.

Normally my day starts around 4 am when i bounce out of bed crank out 100 situps and 50 pushups. 30 minutes of yoga and a protein shake later and I am out the door. The 40 minute commute on the L allows me a chance to catch a couple unbiased podcasts and read the morning edition of the Journal which is my favorite read.

Once in the office I stop by my 7:15 am meeting to discuss the 7:30 am meeting in which we will schedule our 11:30 meeting.  The rest of my morning involves pretending that I look busy so that when people walk by my cube they don’t rat me out.  My afternoon is mostly spent writing spec documents that will never be seen and answering redundant questions.  About 4:30 I sit down to write some code and by 7:00 I am out the door.  15 checks of my email and it is off to bed and the cycle starts all over again!

Actually my days are nothing like that! :)  I am a very laid back person that works for a great small company that values all the right things.  Ingenuity, productivity, creativity and trust are just of the few of the many qualities that our company respects and constantly strives to achieve even to the point that they have given me this blog.  (Although, secretly I think it scares them a little)

Currently I function as a .net developer, sometimes SCRUM leader and Office DJ!  I get to work with lots of great open source technologies iBatis, nHibernate, log4net, nant, CruiseControl.net and hopefully soon Spring.net.  Most importantly my position allows me to sit at an internet enabled computer and receive the latest developments in the Roller Coaster/Amusement industry!

I am hoping this blog will give me a chance to comment on all of these great things!

Later!
Pat

Posted in General | No Comments »