Posts

Showing posts from September, 2007

Javascript numeric only text box

So working on an asp.net page I found I needed a numeric only text box that allowed numbers from 0-100 with no decimals. I found a range validator would do most of the work but I wanted to keep users from typing in bad values. So after some searching I found javascript has a good solution. I like whitespace so shrink if you're one of those white space freaks.

Update: someone was kind enough to point out an error in my JS! So I went through and made sure it works. And it did need a minor tweak to be correct. So thanks to the poster the corrected script and usage are below.

Update Again:

This is the new and improved function to allow for the tab key to tab out of the text box. IE allows this by default however Firefox really tightens down the text box and doesn't allow anything you don't specify. So I had to add the tab key press. I also cleaned up the code so it isn't a huge chunk of if blocks and is now much more succinct. Please feel free to test and use at …

Welcome jrl-software

Well the end has started. I finally got jrl-software.com up and running.

Clickity Click

The main reason is to pimp my recently released utility called filesort. It sorts a file alphabetically in a pretty quick amount of time. So check out the site and send me feedback!

Convert HTML color to System.Drawing.Color

Ok so I have an HTML color I need to use in an asp.net web app. Problem is most of the asp.net controls use System.Drawing.Color. So I can't just go

TextControl.BackColor = "FFFFFF";

or whatever you have to convert the HTML to a System.Drawing.Color like so:

TextControl.BackColor = System.Drawing.ColorTranslator.FromHtml("FFFFFF");

And voila! HTML colors are now System.Drawing.Colors