Wednesday, May 05, 2004
Another "feature" that has left me skeee-roood
5/5/2004 1:13:03 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  |  Trackback
Tuesday, May 04, 2004
Two seconds after posting the first entry, I discovered some nifty character functions that take care of my globalization problems...
Programming | .Net | C#
5/4/2004 9:04:16 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  |  Trackback
An example of how to format camel back notation as space separated words
Programming | .Net | C#
5/4/2004 8:37:33 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  |  Trackback
NUnit automated test success story
5/4/2004 7:48:05 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  |  Trackback
Tuesday, April 27, 2004
my first NUnit ecperience, very pleasurable indeed!
Programming | .Net | C# | NUnit
4/27/2004 4:52:34 PM (GMT Standard Time, UTC+00:00)  #    Comments [5]  |  Trackback
Thursday, April 22, 2004
a rant about how my recent misfortune, materialistic though it is, is the result of a lack of morality in regular people
4/22/2004 1:35:50 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  |  Trackback
Wednesday, April 21, 2004
And figured out how to restore it!
Programming | .Net | C#
4/21/2004 9:40:19 PM (GMT Standard Time, UTC+00:00)  #    Comments [1]  |  Trackback
The things you never consider...
4/21/2004 8:56:34 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  |  Trackback
Wednesday, April 14, 2004

I wanted to tell my story in detail but I'm finding myself too busy to take the time it deserves.  Instead, I'll say a few words to capture the moment and try to come back to it later.

In a car, the windows are small and the passengers are low and close to the ground.  The view is framed like a television and the world goes by while the occupants feel as though they are basically standing still.  Except for the slight jostling and chages in direction, its hard to tell one is moving at all.  Even in a SUV, the seats are positioned so that the view is tunnelled through the windows.

In a vanagon, you are seated very high and the windows are huge!  The windows go from well above your head to close to your waist.  The steering wheel is horizonally angled rather than nearly straight up and down.  This provides a motorcycle like view of your surroundings.  Add the bumping and shaking and the shear girth of the vehicle and it is very clear that your are the ones moving.  The experience is heightened by the clunkiness of the ride.  The characteristic putt putt of a vanagon engine and whirring of the gears is the final touch to make it a very, very different ride entirely. 

When I say clunkiness, I do not mean junkiness!  The vanagon is a volkswagen in its truest form.  It embodies the definition of a machine.  Elegance is present in pure utility and convenience.  The seats are bolt upright and totally supportive.  A four hour trip is effortless and comfortable and the seats are as comfortable as the othepedist designed Volvo buckets and have the additional joy of classic arm rests.  At first glance, you might notice a lack of modern styling but once you're on the road, that awareness fades away.  You become consumed by the incredible view and the feeling that you are truly going somewhere.  The lack of power can be frustrating if you let it, but accept that as part of its character, and you find yourself grow a fondness for its struggle to climb the hills.  Every incline and stop sign reminds you of the little engine that could.  The drivers behind swerve left and right, certainly pissed off at the damned-hippies who are in their way and making them later than they already are, but you are right on time.  Because your destination was simply the driver's seat and the open road and as long as you are on it, in your westy, you are home.

4/14/2004 3:05:40 PM (GMT Standard Time, UTC+00:00)  #    Comments [4]  |  Trackback

That blasted enter key! Don't press the enter key...

When developing in ASP.Net, much of what we used to do in HTML and classic asp is now wrapped up in the server controls.  One of the things that our qa team finds often is incorrect form submission when pressing the enter key. 

Handling fear of mice

There are several appropriate ways to handle the enter key. 

One thing you can do is define a "default action".  For example, if there are several navigation buttons on your page plus a data entry form, it would make sense that any enter key pressed should fire the form submit action. 

Another thing you could do is cancel the enter key entirely.  If you intend to support more han standard browsers, this is not the best approach.  Some users do not actually use a mouse at all.  Keep this in mind if you use the following example. 

When I have time, I'll show how to implement the first approach using this same script as a starting point. 

For now, we're just going to capture the enter key globally for the form.   In ASP.Net, the form is the usually the entire page.  (Hint: once you've captured the enter key press, you have control of the action. Use control.ClientId to cause a clientside event that will execute the post-back.)

A simple example

<script language=javascript>

            <!--

            var bIsEnterKey = false;

            function checkKeyPress(){

                  return !bIsEnterKey;

            }

            function setKeyPress(){

                  bIsEnterKey = (event.keyCode.toString() == '13');

                  window.setTimeout("bIsEnterKey=false;",1000);

            }

           

            //-->

</script>

 

 

<form id="Form1" method="post" runat="server" onsubmit="return checkKeyPress();" onkeypress="setKeyPress()">

What happens?

When the page renders to the client, anything that ASP.net normally adds to the onsubmit event will precede the custome function call.  Therefore, the last thing to happen is going to be the enter key check.  If you have validators on the page, they will be executed first.  If the validation fails, the enter key check will not be called.  In most cases, this is desired, but you need to be aware of it.  Validators can mess with your head!  The good new is that once validation is successful, the enter key function will be called.  If the enter key was the source of the form submission, what ever you've defined in the function (in this case: cancel the form submit)  is going to happen. 

In the rendered page notice the form onsubmit action.  This show the result of placing a RequiredFieldValidator on the page.  Nothing special needs to happen beyond the code shown above.

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<HTML>

  <HEAD>

                  

                   <script language=javascript>

                   <!--

                   var bIsEnterKey = false;

                   function checkKeyPress(){

                             return !bIsEnterKey;

                   }

                   function setKeyPress(){

                             bIsEnterKey = (event.keyCode.toString() == '13');

                             window.setTimeout("bIsEnterKey=false;",1000);

                   }

                  

                   //-->

                   </script>

</HEAD>

          <body>

                   <form name="Form1" method="post" action="AdSenseEdit.aspx" language="javascript" onsubmit="ValidatorOnSubmit();return checkKeyPress();" id="Form1" onkeypress="setKeyPress()">

<input type="hidden" name="__VIEWSTATE" value="..." />

                

<script language="javascript" src="/aspnet_client/system_web/1_0_3705_288/WebUIValidation.js"></script>

 

 

                             <div id="pnlPropFields" align="Center" style="width:600px;">

 

Programming | .Net | C#
4/14/2004 2:32:43 PM (GMT Standard Time, UTC+00:00)  #    Comments [3]  |  Trackback
Monday, April 12, 2004
oh, ink. now I get it.
Programming | .Net | C#
4/12/2004 5:48:36 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  |  Trackback
Wednesday, April 07, 2004
A rant about the state of things
4/7/2004 2:46:16 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  |  Trackback
the hard way
Programming | .Net | C#
4/7/2004 2:27:08 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  |  Trackback

Theme design by Jelle Druyts

Pick a theme: