PeterCallaghan.com

Personal website of Peter Callaghan

ASP.NET Uppercase text in a Textbox control

June15

Earlier today I was looking for an easy way to force users to enter Uppercase text into a textbox on a web form I was creating. There are a few different solutions out there, including some Javascript functions to call when the user types into the text box, but I wanted something that wouldn’t require too much javascript (or none at all). There were also some solutions that would allow the user to type whatever, then when the textbox loses focus, it would change to upper case. Again, not bad, but not what I wanted. What I wanted was, regardless of what the user entered, the textbox would display uppercase.

Step in CSS! There is a CSS property text-transform, which can be either capitalize, lowercase or uppercase. What this will do will force the text entered to display as capitalized, lowercase or uppercase (whatever you choose). Now, this looked like a winner, as there was no scripting needed. However, this only does half the job. All the CSS class will do is display what is entered as uppercase, not actually convert it to uppercase.

The fix… when you get the text from the textbox in your codebehind, use the .ToUpper() method to convert the entered text to uppercase.

In Summary

  1. Add a CSS class with text-transform: uppercase;
  2. Add this CSS class to any textbox you want to have uppercase text.
  3. When getting the text from the textbox, use the .ToUpper() method to convert the text to uppercase.

For me, this was the best solution, as it does not require any javascript, uses a simple CSS class, and only a very minor modification to the codebehind to make sure the uppercase text is taken as uppercase.

I hope someone else finds this helpful.

DropBox – Online data storage

June4

A work colleague showed me DropBox today, as they were saying they have work files spread between their desktop at home, and a laptop. Now, I haven’t used it yet, but DropBox seems to be a nice and easy way to set up a synced folder between multiple machines.

The only issue I have with it is that your files are stored on the DropBox server. You are placing faith in the security of their server to make sure your files are safe. It got me thinking, how hard would it be to do something similar using your own server?

I am going to look into this and may look into developing a solution for people to use their own servers.

Theme Change

June2

Just a quick note to say I’ve changed the theme of my site. I need to make a few minor changes which I will do shortly.

Let me know what you think.

Google Sync for iPhone

April21

Recently, a friend of mine with an iPhone lost all of their contacts because they stopped using MobileMe.  I’ve had an iPhone since they were first released here in Australia, and never had the need to use MobileMe.  They were using the free trial, and cancelled the account as they did not think the service was worth the subscription fee.  The worst thing was they would have to pay the fee to get the contacts back from MobileMe.

This got me thinking… If I was to lose my phone, or lose my contacts off my phone, I don’t have a backup of them anywhere other than the iTunes backups.  I found out that you can sync your contats to Google Contacts, and is easily done through iTunes.

Seeing as I already had a Google account (I’ve been using Google Apps for a few years now for my domain), I figured I’d give it a shot to see how it all works.  First things first, I backed up my iPhone, and my Google Contacts, I strongly suggest you do the same before changing any syncing options for your phone, just in case anything goes wrong.

My first concern was which direction the syncing goes… would I lose all my iPhone contacts and my Google Contacts be pushed to the phone?  Or would I lose all my Google Contacts…  Well, it’s a 2-way sync.  It merged both the phone and google lists together, so now I have all my iPhone contacts in my Google Contacts account.  A good time to take another backup of Google Contacts.

Now, during my research into the iPhone and Google Contacts, I came across Google Sync.  This was interesting to me, as it allowed you to set up your Google Account as though it was a Miscrosoft Exchange server, which will take care of your contacts, calendar and email, with push notifications (if you wish).  This was interesting because it’s a way to sync a Google Calendar to your iPhone calendar without any 3rd party apps.

So now I have my iPhone contacts synced to Google, I thought I’d give this method a try and see how it worked.  I followed the steps on Google Help, and it worked flawlessly… almost.  I opened my contacts, and I had duplicates of all my contacts.  This was because in step 13, I kept my phone contacts, and seeing as I’d already synced my contacts to Google, I now have two copies.  The phone version, and the Google version.  Once I had verified everything else was working fine, I went back into the settings for the Exchange account, then disabled and re-enabled the contacts syncing.  This prompts again what you would like to do with your local contacts.  This time I clicked the Delete option, safe in the knowledge I had my backups in case anything went wrong).  I was happy to see that I no longer had duplicates, and the contacts were synced with Google Contacts.

The final step was to go back to iTunes and stop manually syncing with Google Contacts, as this is automatically done through the exchange set up.

So far so good.  I think that this solution is a great (and free) alternative to MobileMe, so long as you don’t need features such as iDisk and Remote Wipe, then this is a perfect solution.  Plus, it’s good to know if I don’t have my phone with me, but can access the web, I have access to all my contacts.

posted under iPhone | No Comments »

Windows 7 Upgrade

January20

Anyone who is considering upgrading to Windows 7, be aware that upgrading from a current Windows Operating System is very limited.  Only certain versions of Vista can be inline upgraded to Windows 7, the rest require a custom install, which means a clean installation.

If you are staying with the same flavour of Windows, then this won’t be an issue.  You can upgrade from Vista Home (basic or premium) to Windows 7 Home, or from Vista Business to Professional.  However, you can’t go from a Home version to the Professional version of 7.

You can upgrade any version to Windows 7 Ultimate, if you are willing to shell out the extra for the Ultimate version.

If you are wanting to upgrade from XP to Windows 7, you are going to have to go for a clean install :( .  There are tools to make it a little easier though.

I highly recommend using the Windows 7 Easy Transfer Tool when doing a custom upgrade (clean install).  It will make copies of all your user accpunts, save all your documents and settings for your programs and make it very easy to import into the new install of Windows.  You will still need to install all your programs again, but for the most part, all your old settings will still be there.  The transfer tool also gives you a report of everything transferred, and also gives a list of programs you will want to install (from the list of program settings it saves).  The Transfer Tool makes the upgrade process a lot easier.

posted under Windows 7 | No Comments »

Photo galleries added

January7

I’ve added the NextGEN Gallery plugin today and have added a couple of photo galleries. Click on the Photos link at the top of the page to have a look.

Site Update

January7

After many months of inactivity on my site, I decided to move over to a Content Management System (CMS).  I have heard of a few people using WordPress as a CMS, so decided to take the plunge and see what all the fuss is about.

So far so good!

I’m still in the process of figuring out how it all works, but I should get some more pages up and running soon, and have some plans for the site.

Stay tuned :P