Registration form in asp.net with Database Validation

In this Tutorial, we are creating a Registration form in asp.net with database validation. First, we design form and then create a database. after all this process done we will validate user input from the text boxes. The user will fill up the registration form with details such as username, email address, password etc. and these details will be saved in the database table. we will validate user by required field validator, comparison field validator, and range validator.

Asp.net Registration Form
Registration From with Asp.net

Prerequisites

VS2010/2012/2013/15/17, SQL Server 2005/08/2012

Project used version

VS2015, SQL SERVER 2012

Following are the steps to create this form

Step 1:-
Creating Design For Registration Page

Open Visual Studio and click on new Project > Select Asp.net Web Application > name project as asp.net registration form > click on OK.

Right-click on project and select Add > Webform > name it as Registration.aspx file.

Right-click on Project again and select Add > Style Sheet > name it as Style.css.

Go back to you Registration.aspx page and create form title and go to the <head> section of registration.aspx page and link style.css file.

Import this code into <head> tag of registration.aspx page.

In the <style> tag we import font family from google font. this font is used in this tutorial. so make sure your internet connection is on.

Step 2:-

Now, we want to design the form. So, go to the <body> tag of registration.aspx page.

Import this code in <body> tag of Resitration.aspx page.

Step 3:-

After your form had designed you need to create stylesheet CSS classes for asp.net elements.

Open the Style.css file and place this code into Style.css file.

Import this Code into Style.css file.

Step 4:-
Create a folder in your project.

Right-click on your project > go to Add > select New Folder > name it as Images.

import background images into the Images folder. You can download this Image from following link Image_1 and Image_2.

Step 5:-
Create Database and a table

Right-click on project > go to add > and select SQL SERVER DATABASE > Name your database DB_1 > after your database created double click on it > right-click on table > select New Query.

Write query to create table in SQL DATABASE

Step 6:-

Go back to your Registration.aspx page and below of <form> tag drag and drop sqldatasource.

The left side of your window clicks on design and go to sqldatasource and click on ‘>’ this icon.

select configure data source > on the next window select database and click on next > again click on next > Test your query and click on Finish.

Step 7:-

Next, We need to create an event on Submit button to create this go to <button> and type Onclick=”Button_click”. we already import this code into <button> in Step 2. you just need to right click on registration.aspx page and select view code. if your code is not generated automatically then place this code into registration.aspx.cs file.

Leave a Reply

Your email address will not be published. Required fields are marked *