0151 355 4555

ASP.NET Validation Controls

Our ASP.NET validation controls provide a quick and easy way of adding address validation, telephone validation and email validation to your ASP.NET Web Forms.

To get started, download and install the controls. You'll also need to contact us for a free trial for the controls to function.

Once you've installed the controls, they will appear on a new Data8 tab in your Visual Studio toolbox.

You can now drop in the new AddressCapture control onto your web page, set the Username, Password and License properties to your Data8 login details and you'll have a fully usable address validation tool.

To access the address that has been entered by the user, you can use some code similar to the following:

protected void Button1_Click(object sender, EventArgs e)
	if (!Page.IsValid)
	// Save the address to a database as individual lines
	SqlDataSource1.InsertParameters["address1"] = AddressCapture1.Address1;
	SqlDataSource1.InsertParameters["address2"] = AddressCapture1.Address2;
	SqlDataSource1.InsertParameters["address3"] = AddressCapture1.Address3;
	SqlDataSource1.InsertParameters["address4"] = AddressCapture1.Address4;
	SqlDataSource1.InsertParameters["town"] = AddressCapture1.Town;
	SqlDataSource1.InsertParameters["county"] = AddressCapture1.County;
	SqlDataSource1.InsertParameters["postcode"] = AddressCapture1.Postcode;
	// Or, save the address as one string value including all the lines
	SqlDataSource1.InsertParameters["address"] = AddressCapture1.FullAddress;

Finally, you just need to ensure that your users do complete their address. Just drop a regular RequiredFieldValidator control onto your page, and set up its ControlToValidate property to be the AddressCapture control, and set its ErrorMessage property to a helpful message.

You can also add the TelephoneValidator and EmailValidator controls to your pages to enhance your validation of telephone numbers and email addresses. Because they work in exactly the same way as the standard ASP.NET validator controls, you can just add them into your pages in the same way you're used to.