Latest Entries

Consuming RSS feeds in an ASP.NET page

calendar_today 18 August 2007 23:12

ASP.NET 2.0 ASP.NET Web Forms

I like reading Scott Guthrie's blog. Trouble is, I get so busy, I forget to go over there and have a look to see what's new. I was searching for something the other day, and stumbled across someone else's blog (I forget whose), but I noticed that they had the 5 most recent items in Scott's blog embedded in their home page. It was only then that I discovered that Scott Mitchell has written a whole load more tutorials on Data Access, and that these have been available for a while. So I got to thinking that I should add a feed from Scott G's site onto the home page here, so I can be updated more quickly. Here's the bare bones of how I did it.

Debugging Classic ASP pages in Visual Studio 2005 on Windows XP Pro

calendar_today 17 August 2007 10:28

Classic ASP Visual Studio

As an ardent Dreamweaver user for classic ASP, I used to debug my scripts with a plethora of Response.Write and Response.End statements, outputting the values of various values to the browser to check that logic was working as intended. However, I recently discovered how to use the VS 2005 debugger to make debugging classic ASP (almost) a joy.

List the contents of a folder and link to each file

calendar_today 10 August 2007 21:33


Iterating the contents of a folder is straightforward using classes from System.IO, and listing them as links to the actual file just requires a bit of html added to each file name.

Exporting data to a CSV, tab delimited or other text format

calendar_today 02 August 2007 23:41


A question that often comes up in forums is how to export data to a CSV file, or other text format. Here's a method that takes data from a DataReader and writes it to a file.

Displaying One-To-Many Relationships with Nested Repeaters

calendar_today 27 July 2007 14:24


This item could also have been entitled "Displaying Master-Detail Data" or "Displaying Categorised Data", but the principal is the same: you have what are essentially headings or categories, and a group of entries that belong to each heading that you want to display. Typical examples would include the Models of cars by Manufacturer, or Employees by Department. Here's how to do it quite simply using nested Repeaters.

Customising a ListControl's DataTextField value

calendar_today 06 July 2007 12:19

ASP.NET 2.0 ASP.NET Web Forms

The DataTextField property is used with ListControls - RadioButtonList, CheckBoxList etc to specify a field in the DataSource property to display as the items of the list in the list control. Sometimes, however, you don't want just the value from one database field to appear in the list, and there are a couple of ways to achieve this, depending on what you want to do.

A more efficient RSS feed with C#

calendar_today 06 June 2007 23:15

C# ASP.NET 2.0

The contents of an RSS feed only change when items that appear in it are added or amended, so the feed created in the previous article (Create an RSS Feed In ASP.NET 2.0 C#) is rather inefficient, in that the output is generated everytime the feed is requested. Here's an improvement.

Getting the identity of the most recently added record

calendar_today 05 June 2007 22:13

SQL SQL Server Express MS Access ADO.NET

The built-in functions @@Identity and Scope_Identity() are designed to retrieve the most recently added record's autoincrement identity value from Access and Sql Server respectively. Here are some usage examples.

Saving a user's CheckBoxList selection and re-populating the CheckBoxList from saved data

calendar_today 03 June 2007 22:56


The user has gone to the trouble of selecting a list of checkboxes to indicate their choices. Now you need to re-present their selections so that they can edit them. How do you make sure the correct checkboxes are ticked?

Basic file management with System.IO in ASP.NET

calendar_today 29 May 2007 12:37

C# ASP.NET 2.0

Some basic file and folder management tasks that require the use of classes inside System.IO

VBScript to C# - Equivalent string functions

calendar_today 28 May 2007 21:18

VBScript C#

A Cheat Sheet containing the VBScript string functions and their equivalent methods in C#.

C# Regular Expressions - the basics

calendar_today 24 May 2007 22:01


The is a brief overview of the main classes and methods in the System.Text.RegularExpressions namespace. It doesn't cover Regex patterns in any real depth at all, but gives an introduction to the power of regular expressions using C#.

How to read a remote web page with ASP.NET 2.0

calendar_today 21 May 2007 21:38

C# ASP.NET 2.0

Two classes in the System.Net namespace make it very easy to obtain the html of a remote web page. These are the HttpWebRequest and HttpWebResponse. Here's a quick demo.

Splitting strings with C# and VB.NET

calendar_today 20 May 2007 20:21

C# VB.Net

Examples of splitting strings into arrays using C# and VB.Net, both with the String.Split() method, and the Regular Expressions Split() method.

C# Regular Expressions Cheat Sheet

calendar_today 19 May 2007 20:36


Cheat sheet for C# regular expressions metacharacters, operators, quantifiers etc

Programmatically accessing data from DataSource controls

calendar_today 16 May 2007 10:06


For the main part, the DataSource controls are incredibly easy to work with. You just drag them onto your page in Design View, wire them up to a connection and provide some kind of command (ad hoc sql query or the name of a stored procedure - saved query in Access), then link them to a databound control on the page using its DataSource property. Then you run the page and all your data appears. But what if you want to get at one or more values from the returned data to do something else with it, like display it in a control that doesn't expose a DataSource property?

VBScript Regular Expressions Cheat Sheet

calendar_today 14 May 2007 08:44


Metacharacters for use with VBScript regular expressions

Javascript functions for form fields

calendar_today 12 May 2007 22:54


A number of useful functions for accessing various properties and values of form fields.

Binding data to a DropDownList with ADO.NET

calendar_today 11 May 2007 22:35


Using ADO.NET to pull data from the Northwind database (Access version), using the saved query Current Product List.

Send form content by email in ASP.NET

calendar_today 10 May 2007 22:53

C# ASP.NET 2.0 VB.Net

Using ASP.NET to send the contents of a form by email is a common requirement. This sample looks at generating an email using System.Net.Mail in both plain text and html format from a very basic Contact Us form.