Dirty Tricks for Dirty Problems

Posted by: Imar Spaanjaars at Sunday, February 03, 2008 1:23:10 PM in: JavaScript
A while ago I needed the ability to display a "no image available" image in a list of products when an image for that product was not available on the server.
Read on ...

Fun With Linq!

Posted by: Imar Spaanjaars at Friday, March 16, 2007 4:30:33 PM in: C#

Quite often I have discussed the impossibility of joining data from a database with that of the file system. I discussed it with my team members, mentioned it in trainings and wrote about it recently in this article.

Being able to join data from a database with other data from a file system could be very useful though.

Read on ...

Sending Attachments Directly From a FileUpload Control

Posted by: Imar Spaanjaars at Friday, December 08, 2006 3:25:45 PM in: ASP.NET 2.0

With previous versions of ASP.NET you couldn't attach an uploaded file directly to a mail message. Instead, you needed to save the file to disk, attach it to the mail message and then when sending the message succeeded you had to clean up the old file again.

This not only meant a lot of work, it also had some security implications. Because the file needed to be written to disk, the account used by the web server required write permissions to a folder to store the attachments.

Now, with the new constructors for the Attachment class from the System.Net.Mail namespace, these problems are gone....

Read on ...

Filling a DataTable or DataSet the Quick Way

Posted by: Imar Spaanjaars at Tuesday, September 19, 2006 8:29:13 PM in: ADO

In .NET 1.x filling a DataSet or a DataTable meant quite some work. You needed to create a Connection object, a DataAdapter and optionally a Command object. Then you had to call the Fill method on the DataAdapter and pass it a newly created DataSet or DataTable.

In .NET 2.0, this code model has been simplified, thanks to the Load method on the DataTable and DataSet classes that takes an IDataReader as a parameter.

Read on ...

Easily Embed a Windows Media Player in a Web Page

Posted by: Imar Spaanjaars at Sunday, August 06, 2006 7:22:45 PM in: (X)HTML
I keep forgetting the code that's required to embed a Windows Media Player movie in a web page, so I decided to add it to my Snippets collection for easy reference.
Read on ...

Send Out XHTML to Browsers That Support It

Posted by: Imar Spaanjaars at Tuesday, May 23, 2006 5:35:31 PM in: ASP.NET 2.0
A while ago I saw this useful tip to instruct an ASP.NET 2.0 application to send the response as valid XHTML / XML.
Read on ...

Binding ObjectDataSource controls to Custom Methods

Posted by: Imar Spaanjaars at Sunday, April 17, 2005 6:39:28 PM in: ASP.NET 2.0
The new ASP.NET 2 data controls, like the SqlDataSource and the AccessDataSource grealty simplify data access in your Web Applications. However, they have one major drawback: they flood your pages with Sql statements. Not so with the ObjectDataSource, that enables you to bind to the results of a standard method in your Business Logic Layer. The ObjectDataSource can in turn be bound to a data aware control, like the new GridView or DetailsView controls
Read on ...

Overriding Individual Application Settings

Posted by: Peter Lanoie at Thursday, March 03, 2005 10:55:01 PM in: .NET General
You may have the situation where you want to be able to override application settings for a .NET application only for your particular instance of the application. This is often the case when you are developing the application, you need to change only the local settings, but you don't want to change the config file that is part of the project and under source control. Here we'll explain the solution that .NET provides but isn't so well known.
Read on ...

How Do I Pass Credentials to a Web Service that Uses Basic Authentication?

Posted by: Imar Spaanjaars at Saturday, February 26, 2005 3:20:31 PM in: ASP.NET 1.x
When you're working with Web Services that require authentication, you'll need a way to pass credentials. This snippet shows you how to pass a user name and password to a Web Service that is configured for Basic Authentication.
Read on ...

A Scrollable Table With a Fixed Header

Posted by: Imar Spaanjaars at Sunday, February 13, 2005 12:35:08 PM in: CSS
Consider this solution as obsolete as there are better alternatives available. Search the comments to this article for a few external links to better implementations.

If you need to present a lot of table based data, but you don't want to spoil your page layout with a very long table, you can use the following trick to create a scrollable table with a fixed header.
Read on ... 1234