Differences between asp + and asp (5)

Source: Internet
Author: User
Tags unique id
How does server-side control work?
Author: qingapple Computer Studio
How is this implemented? The key is the runat = "server" attribute. To learn how this works, see the browser page.
Source code. Yes:
<HTML> 〉
<BODY> 〉
You selected 'Windows 98 'for machine 'tification '.
<FORM name = "ctrl0" method = "post" action = "pageone. aspx" id = "ctrl0"> "〉
<INPUT type = "hidden" name = "_ VIEWSTATE" value = "a0z1741688109 _ x"> "〉
Machine Name:
<INPUT type = "text" id = "txtName" name = "txtName" value = "Tietong"> "〉
<P/> /〉
Operating System:
<SELECT id = "selOpSys" size = "1" name = "selOpSys"> "〉
<OPTION value = "Windows 95"> Windows 95 </OPTION> 〉
<OPTION selected value = "Windows 98"> Windows 98 </OPTION> 〉
<OPTION value = "Windows NT4"> Windows NT4 </OPTION> 〉
<OPTION value = "Windows 2000"> Windows 2000 </OPTION> 〉
</SELECT> 〉
<P/> /〉
<INPUT type = "submit" value = "Submit"> "〉
</FORM> 〉
</BODY> 〉
</HTML> 〉
Use this ASP + code to create the <FORM> 〉:
<FORM runat = "server"> "〉
...
</FORM> 〉
When the page is executed by ASP +, the output to the browser is:
<FORM name = "ctrl0" method = "post" action = "pageone. aspx" id = "ctrl0"> "〉
...
</FORM> 〉
You can see that the action and method attributes are automatically created by ASP +, so the values controlled in the form will be sent back to the same page.
ASP + also adds the unique id and name attributes for the form, because we didn't provide them. However, if you specify these attributes,
The specified value is used.
If the method = "GET" attribute is included, the content of the form is sent to the server as part of the query string.
Unlike ASP in earlier versions, automatic status management is no longer effective.
In the form, use the following ASP + code to create a text box:
<INPUT type = "text" id = "txtName" runat = "server"> "〉
The result of the browser is as follows:
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.