Sunday, February 29, 2004

More Pictures

Seeing as I'm here in Israel, it would be a crime if I didn't go to see Jerusalem - so I went on a guided tour yesterday. Pictures from the trip can be found here:

http://gallery.edcourtenay.co.uk/albumListing.aspx?albumID=5&albumName=Jerusalem.

 Wednesday, February 25, 2004

First Pictures Up

I've got my SmartMedia card reader hooked up, so I've started uploading some pictures from my trip here:

http://gallery.edcourtenay.co.uk/albumListing.aspx?albumID=4&albumName=Israel+Trip

 

First Impressions

It's the end of my first full day in Israel working with Panam on behalf of IS Solutions, and so far things are very enjoyable. The only fly in the ointment so far is I've yet to get net access for my laptop, and the systems here are firewalled off so I can't ssh to my linux box to collect my mail (I normally use mutt while I'm away). It's at times like this I realise just how dependant on email I've become for communication; it almost feels like I've lost a limb!

The flight to Tel Aviv was uneventful, save a mild bit of turbulence, and after yet more interrogation at the Passport office I was collected and driven to my hotel in Netanya.

Unfortuately I can't upload any pictures as yet (due to the aforementioned lack of net access for laptop), but the room is great. Well, it's not a room, it's a suite. Excellent; personally I'd have been fine with something a lot smaller, but I'm not complaining (and if anyone from the office is reading this, I ain't moving.... ;-))

 Tuesday, February 24, 2004

Off To Israel

Well, after a very thorough security check at the ElAl check in at Heathrow, I'm on my way to Tel Aviv for two weeks, working with Panam.

If anyone needs to get in contact with me I'll be checking my email on a regular basis, and I'm staying at the Seasons Hotel in Netanya.

It's going to be the longest time that Bec and I have been apart since, well, forever. I just hope that Zak and India don't play her up too much while I'm away (but then again, what else can I expect from a fiesty almost 3 year old, and a very demanding 11 month old). Of course, Bec being 7 and a half months pregnant makes things even more interesting for her.

Damn I'm going to miss them all.

Oh well, off to the duty free shops...

 Monday, February 23, 2004

ASP.NET Focus Component

One of the small irritants in the ASP.NET framework is there is no built-in mechanism to set the focus of a control directly in code - you have to emit javascript to handle the job for you.

This is no problem, as ASP.NET gives you standard methods that allow you to register client script blocks with a page, but most of the solutions I've seen to this problem so far involve adding code directly to the inherited Page object to do the job.

However, this to me is untidy and as it's a common enough function to want to achieve, it would be nice to have a component you can quickly drop onto your page.

The code that follows does exactly that; once added to your toolbox, you can drop this component onto your ASP.NET design surface. From the properties box, simply set the ControlToFocus property to the control you want to, er, focus.

It works by handling the target controls' PreRender event, and injecting a startup script into the associated Page object. Very, very simple.

using System;
using System.ComponentModel;
using System.Web.UI;

namespace EdCourtenay.Community.WebControls
{
    public class FocusSetter : Component
    {
        private Control focusControl = null;
    
        public FocusSetter()
        {}

        public Control ControlToFocus
        {
            get { return focusControl; }
            set
            {
                if (focusControl != null)
                    focusControl.PreRender -= new EventHandler(FocusControlPreRender);

                focusControl = value;

                if (focusControl != null)
                    focusControl.PreRender += new EventHandler(FocusControlPreRender);
            }
        }

        private void FocusControlPreRender(object sender, EventArgs e)
        {
            Control control = (Control)sender;
            Page page = control.Page;

            if (page != null)
            {
                string script = String.Format("<script type=\"text/javascript\">document.getElementById(\"{0}\").focus();</script>", control.UniqueID);
                page.RegisterStartupScript("focusControl", script);
            }
        }
    }
}