After studying web server controls now let's create a user registration form. This web form takes user input and submits to the server. After submitting, it return message of successfully registered. This whole process takes the following steps.
- Add a Web Form to the project
This form contains some default html code.
- Adding Controls to the form
To add controls to the form either we can drag components from the toolbox or write code manually to create the components.
The following file contains the code for a user registration form.
// WebControls.aspx
- Handling Submit Request
In code behind file, we are adding a message that trigger only when user submit the registration form. This file includes the following code.
// WebControls.aspx.cs
- Run User Registration Form
To run this form, just right click and select view in browser option. We did it in our example.
Output:
And it produces the following output.
After filling the form and registration, it shows a greeting message to the user.
After submit the registration details.