Creating Checkboxes that Behave Like Radio Buttons with jQuery

Posted by: Imar Spaanjaars at Thursday, July 21, 2011 11:16:02 AM in: Web General

Some time ago I received a question on the Wrox P2P forum about checkboxes that should behave like radio buttons. The poster of the question was looking for a (client side) solution to have multiple checkboxes per row in a GridView with multiple rows. A user should only be able to check off at most one of the checkboxes in each row. My first thought was to use radio buttons instead, but then I realized that with radio buttons you lose the ability to uncheck all options. Once you've selected a radio button in a group of radio buttons, there's no way for an end user to uncheck it again.

Fortunately, with a bit of jQuery, this is really simple to accomplish with checkboxes as I'll show you in this short article.

Read on ...

Avoiding the "Works on My Machine" Syndrome

Posted by: Imar Spaanjaars at Saturday, March 20, 2010 2:40:42 PM in: Web General
A long time ago I worked on a web application for a large Dutch newspaper that provided access to all pictures that had ever been published in the paper, or were taken by photographers employed by the publishing agency. In total, there were around 250,000 pictures in the database used by the web application. One of the areas I worked on was the "picture list" that had features such as displaying, searching, filtering and paging of pictures. Things seemed to work fine on my machine, even with the large amount of pictures in the database. Until one day I worked from home.
Read on ...

Creating Super Printer-Friendly Pages

Posted by: Imar Spaanjaars at Sunday, January 21, 2007 11:42:55 AM in: Web General

Don't you just hate it? You find a good article somewhere on the Internet and you decide to print it so you can read it later. But when you read it, you find out that all the links in the article are missing. All you see is something like "Click here to read this other very interesting document". On the web site, the word here links to some kind of other document, but on paper that is pretty useless. The only option you have left is to revisit the original article, find the link and follow it.

Fortunately, with a little bit of JavaScript and some DOM modification, it's easy to improve your user's experience, even long after they have visited your site and printed parts of the content.

Read on ...

Howto send E-mail from an ASP page

Posted by: Imar Spaanjaars at Wednesday, February 18, 2004 8:50:30 PM in: Web General
This article will show you how simple it can be to send an e-mail from an ASP page. With just a few lines of code, you can add mail sending capabilities to your ASP page in your Web site. Notice that I put the focus on can be; depending on your network setup, this approach may be very easy, or it may require you to setup or configure your network for this code to work. See the reference section at the end of this document for more information.
Read on ...

Howto Force the Save As Dialog in the Browser

Posted by: Imar Spaanjaars at Tuesday, October 21, 2003 9:20:50 PM in: Web General
Your Web browser is set up to handle all kinds of documents. For example, when you open an .html page from a Web site, the browser knows it should parse this file, and display its rendered contents onscreen. The same is true for images; when you click on a link that directly links to an image, the image will be displayed in the browser.

This default behavior may not always be what you want. In some scenario's, it's useful to have the user download and save the file, instead of displaying it in the browser. This is a common requirement for files like images, Word documents, spread sheets and so on. This article will demonstrate you how you can force the client browser to present the Save As dialog, so your users can download the file and save it on their local hard disk.
Read on ...

Howto Create a Hit Counter Using a Database

Posted by: Imar Spaanjaars at Saturday, October 04, 2003 3:27:03 PM in: Web General
If you have a live Web site on the World Wide Web, you may be interested in how many people are visiting your site. You can of course analyze the log files of your Web server but that information is usually difficult to read. The log files contain information for each and every request a visitor has made to your site, including resources like images, Flash movies and so on. This makes it near impossible to extract information about individual users. It would be a lot easier if you could count the number of individual users that have visited you since you started your site. It would also be useful if you could see the number of users that are currently browsing your site.

This article will show you how to accomplish these two tasks by storing the hit counters in Application variables and in a database using code in the global.asa file. The counters in the Application variables are used to display them on a page in your Web site; either as a counter so your visitors can see it as well, or somewhere on a page in your Admin section, so only you have access to them. By writing the counter to a database you can maintain its value even when you restart the Web server, while you still have a fast and scalable solution.

This article extends the ideas from two previous articles where the values of the counters were just stored in Application variables and in a text file.

There is also an ASP.NET version of this article available.
Read on ...

Howto Create a Hit Counter Using a Text File

Posted by: Imar Spaanjaars at Saturday, October 04, 2003 3:18:37 PM in: Web General
If you have a live Web site on the World Wide Web, you may be interested in how many people are visiting your site. You can of course analyze the log files of your Web server but that information is usually difficult to read. The log files contain information for each and every request a visitor has made to your site, including resources like images, Flash movies and so on. This makes it near impossible to extract information about individual users. It would be a lot easier if you could count the number of individual users that have visited you since you started your site. It would also be useful if you could see the number of users that are currently browsing your site.

This article will show you how to accomplish these two tasks by storing the hit counters in Application variables and in a text file using code in the global.asa file. This article extends the ideas from a previous article where the values of the counters were just stored in Application variables. By writing the counters to a file you can maintain their values, even when you restart the Web server.

There is also an ASP.NET version of this article available.
Read on ...

Howto Create a Hit Counter Using the Global.asa File

Posted by: Imar Spaanjaars at Saturday, October 04, 2003 11:27:01 AM in: Web General
If you have a live Web site on the World Wide Web, you may be interested in how many people are visiting your site. You can of course analyze the log files of your Web server but that information is usually difficult to read. The log files contain information for each and every request a visitor has made to your site, including resources like images, Flash movies and so on. This makes it near impossible to extract information about individual users. It would be a lot easier if you could count the number of individual users that have visited you since you started your site. It would also be useful if you could see the number of users that are currently browsing your site.

This article will show you how to accomplish these two tasks by storing the hit counters in Application variables using code in the global.asa file. The disadvantage of this method is that this information is lost when you restart the Web server. Two subsequent articles will demonstrate how to store this information in a text file and in a database, so the value for the counter will be preserved when you restart your Web server.

There is also an ASP.NET version of this article available.
Read on ...

Howto Style the Button of a input type="file" Control

Posted by: Imar Spaanjaars at Wednesday, October 01, 2003 5:13:55 PM in: Web General
Update!! 12-20-2003
There seems to be a problem with the code presented in this article. When you click the new and styled Browse button, the Browse for File dialog is opened, and when you select a file, both text boxes (the hidden and the fake field) are displayed with the file's full path and filename. However, when you click the submit button, the real (and hidden) file box gets cleared and the form will not submit. When you click the submit button again, the form will eventually submit, but because the file box is empty, your file will not be uploaded to the server. This problem has been discussed extensively on various forums on the web, including the one run by Wrox.

So far, I haven't been able to isolate the problem or come up with a solution. It looks like this problem is caused by some security mechanism in Internet Explorer. I haven't tested various versions of IE yet, but I am sure it doesn't run on IE 6, SP1 (well, it doesn't run on *my* IE 6, SP1 ;-) )

If you do find a browser that runs this code fine, please let me know.

When you are using Cascading Style Sheets (CSS) in your Web pages, it is likely that you want to change the appearance of your HTML buttons as well. After all, the dull looking gray buttons give your site a bit of an old fashioned look. Usually, changing the style is as easy as setting a style or a class attribute, like <input type="button" value="Send Form" style="background-color: red";> to give the button a red color. However, this won't work with the Browse button that is attached to an input box that allows a user to upload a file. This article will demonstrate a so
Read on ...

Howto Create a Microsoft Access Database from ASP Code

Posted by: Imar Spaanjaars at Thursday, September 25, 2003 9:48:55 PM in: Web General
Although you should try to make most of your database design decisions at design-time, it can sometimes be really handy to create a database from your ASP code. This article explains how to create a Microsoft Access database using ASP.
Read on ... 1