13.07.2015 Views

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

108<strong>ASP</strong>.<strong>NET</strong> <strong>3.5</strong>: A Beginner’s <strong>Guide</strong>Key Skills & Concepts●●●●Working with form tag and attributesReviewing HTML user input: Text, Submit Radio, and CheckboxMore form formats: Textarea, Select, OptionWhat’s in a name attribute: HTML names and variable namesOne of the frustrations of working with HTML forms is that they cannot work bythemselves. Unless some other programming language is working with the HTMLpage, user entry goes nowhere. Therefore, this chapter reviews HTML forms to show howdata and form names can be passed in <strong>ASP</strong>.<strong>NET</strong> applications. If you’re already familiarwith HTML forms and their attributes, still take a look at the subtle differences betweenusing them with HTML and with <strong>ASP</strong>.<strong>NET</strong>.Working with Form Tags and AttributesAll forms in HTML begin with the tag. If you’re working with some kind ofother code or external file where you want to pass on data entered in the form, you willsee something like the following:The form’s id acts something like a variable name to distinguish it from any other formsthat might be in the page. The action calls a URL invoking the called program. If you’refamiliar with the original <strong>ASP</strong> or with PHP, you know that the data in the HTML formscan be passed to these other programs that are called. The final <strong>com</strong>mon attribute is amethod with one of two values, post or get. The method used depends on whetherthe form is idempotent or not. For all practical purposes, an idempotent method is onewhere the values are unmodified even when multiple calls are made. Non-idempotentmethods are ones where the values may change. When the forms are idempotent,

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!