Course ASP.NET : forms and server controls

Course ASP.NET : forms and server controls



Course ASP.NET : forms and server controls








Forms on a Web page are important as they provide the means through which a user can enter data and send it to the Web server. The method by which this is done is by using
tag. Once data is sent to the Web server, it is processed by a script associated with the form.

ASP.NET forms are somewhat different from the HTML forms.  Let’s look at the HTML forms.e

HTML Forms


A form is created by using the
tag. Various controls such as text boxes and radio buttons are used to capture data from the user. The tag supports eleven attributes; however two are commonly used:

·        action – specifies the script page that will process the form data,
................    

·        method – specifies the HTTP method by which form data is transmitted. Commonly there are two methods of transmission: GET and POST.

The GET Method:

The GET method is the default, and is normally used to retrieve files from the Web server. However, when it is used in conjunction with
tag, it sends the form data to the Web server.  In this case, the form field-value pairs are sent to the Web server by appending to the URL of the Web server, after a question mark. The part appended to the URL is known as query string.

For example:

Here “&” separates the name-value pairs and “=” separates the name and value.

The POST Method:

In this method, the form information is sent to the Web server in the body of the HTTP Request rather than part of the URL. However, this method is no better secured than the GET method. It allows more information to be sent

In ASP.NET there is no choice of method of transmission, POST is the only method used. 


HTML Form Controls

 

The traditional HTML form supports several controls, and tag is the most common that is used to define text boxes, radio buttons, check boxes, buttons, submit button, reset button, password fields, and hidden fields. 

 

Input
Creates form elements such as text and password boxes, hidden fields, radio buttons, check boxes, submit and reset buttons, images, and buttons
Select
Creates elements such as a drop-down list and a list box
Textarea

0 commentaires: