HTML and CSS Reference
In-Depth Information
buttons. You can do so using the
formaction
and
formmethod
attributes of the
<input>
element. Listing 5-17
shows how.
Listing 5-17.
Setting a Form's Action and Method Using the
<input>
Ta g
<form action="/Home/Index" method="get">
<input id="btnSubmit" type="submit" value="Submit"
formaction="/Home/Index2"
formmethod="post" />
</form>
The
<form>
tag's
action
attribute is set to
/Home/Index
, and its
method
attribute is set to
get
. You
override these defaults through the
<input>
tag by setting the
formaction
attribute to /Home/Index2 and
the
formmethod
attribute to
post.
Other Submit buttons on the form (if any) use the action and method as
specified at the form level.
Designing an Employee Data Form
Now it's time to put your knowledge of HTML5 form features to use and develop a complete form that
deals with data from a SQL Server database. In this section, you develop an ASP.NET Web Forms
application that inserts data into, updates data in, and deletes data from the
Employees
table of
Northwind
database. The main form of the application is shown in Figure 5-21.
Figure 5-21.
Employee data form