Download the Code [^] -
Updated 4/3/2002
For lack of something better to do, I added an email sign-up to my web site -
unfortunately however, I don't have a newsletter, just a place to sign-up.
The code was designed as a User Control to make it more portable. Next I added
an email RegularExpressionValidator control to accompany and validate the
textbox.
The .aspx page consists of a single placeholder. The balance of the code is
in the .aspx.cs file and has been commented.
Things to look for in the .aspx.cs file:
1) Create and add an html table from the .aspx.cs page;
2) Create and add a textbox to an html table;
3) Create and add a validator to a textbox; and
4) Create and add a button with an event handler to process the textbox.
The SQL code to create the database:
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[aEmailSignUp]')
and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[aEmailSignUp]
GO
CREATE TABLE [dbo].[aEmailSignUp] (
[Id] [int] IDENTITY (1, 1) NOT NULL ,
[Email] [nvarchar] (80) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[List] [int] NULL ,
[SignUpDate] [datetime] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[aEmailSignUp] WITH NOCHECK ADD
CONSTRAINT [PK_aEmailSignUp] PRIMARY KEY CLUSTERED ([Id]) ON [PRIMARY]
GO
Top 