HOME

ASP.NET Tutorial
ASP.NET HOME
ASP.NET Intro
ASP.NET vs ASP
ASP.NET Install
ASP.NET Pages
ASP.NET Controls
ASP.NET Events

References
HTML Controls
Web Controls
Validation Controls

Please visit our sponsors !

HtmlForm Control

Back

Definition and Usage

The HtmlForm control is used to control a <form> element. In HTML, the <form> element is used to create a form.

Note: All HTML server controls must be within the HtmlForm control!

Note: You can only have one HtmlForm control on a single page!


Properties

Property Description
Action A URL that defines where to send the data when the form is submitted.

Note: This attribute is always set to the URL of the page itself!

EncType The mime type used to encode the content of the form
id A unique id for the control
Method How the form posts data to the server. Legal values are: "post" and "get". Default is "post"
Name The name of the form
runat Specifies that the control is a server control.  Must be set to "server"
Target The target window to load the URL

Example 1

In the following example we declare an HtmlForm control in an .aspx file. Then we modify the method and target of the HtmlForm control in an event handler (an event handler is a subroutine that executes code for a given event). The Page_Load event is one of many events that ASP.NET understands:

<script runat="server">
  Sub Page_Load(Sender As Object,E As EventArgs)
    f1.Method="get"
    f1.Target="_blank"
  End Sub
</script>
<html>
<body>
<form id="f1" runat="server">
<input type="text" value="Donald Duck" runat="server"/>
<input type="submit" value="Submit" runat="server"/>
</form>
</body>
</html>


Back

Jump to: Top of Page or HOME or Printer Friendly Printer friendly page


Search W3Schools:


What Others Say About Us

Does the world know about us? Check out these places:

Dogpile Alta Vista MSN Google Excite Lycos Yahoo Ask Jeeves


We Help You For Free. You Can Help Us!


W3Schools is for training only. We do not warrant its correctness or its fitness for use. The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.

Copyright 1999-2002 by Refsnes Data. All Rights Reserved


Validate How we converted to XHTML Validate

IISProtect
Password Protect
Your Web Pages



Your own Web Site?

Read W3Schools
Hosting Tutorial



$15 Domain Name
Registration
Save $20 / year!



Advertise
at W3Schools

Only 0.5 CPM



SELECTED LINKS

University Online
Master Degree
Bachelor Degree


Web Software

The Future of
Web Development


Jobs and Careers

Web Security
Web Statistics
Web Standards


PARTNERS

W3Schools
TopXML
VisualBuilder
XMLPitstop
DevelopersDex
DevGuru
Programmers Heaven
The Code Project
Tek Tips Forum
ZVON.ORG
TopXML Search