II. ASP + Web Forms
ASP + Web Forms is a new term of Microsoft. According to its own words, the ASP + Web Forms page framework is an upgradeable NGWS runtime Programming model that can dynamically generate webpages on servers. Isn't it easy to understand? Actually, it's just like HTML forms, but it can be dynamically changed on the server side, not as it can be changed once a static HTML form is generated. Of course, DHTML or remote script can also be used for dynamic changes, but it is not very convenient after all. So what exactly is Web Forms? Actually, you have already seen it. Remember the example I gave last time. That's right. It's a Web Forms, but since the example is full of static HTML, so when you press the "lookup" button, you only submit a form and nothing happens. Now let's look at a real Web Forms with an ad rotation control, A text input box, a selection box, a button, and a text tag. The code is as follows.
File: Intro6.aspx
<Html>
<Head>
<Link rel = "stylesheet" href = "intro.css">
</Head>
<Script language = "C #" runat = server>
Void SubmitBtn_Click (Object sender, EventArgs e ){
Message. Text = "Hi" + Name. Text + ", you selected:" + Category. SelectedItem;
}
</Script>
<Body>
<Center>
<Form action = "intro6.aspx" method = "post" runat = "server">
<Asp: adrotator AdvertisementFile = "ads. xml" BorderColor = "black" BorderWidth = 1 runat = "server"/>
<H3> Name: <asp: textbox id = "Name" runat = "server"/>
Category: <asp: dropdownlist id = "Category" runat = server>
<Asp: listitem> psychology </asp: listitem>
<Asp: listitem> business </asp: listitem>
<Asp: listitem> popular_comp </asp: listitem>
</Asp: dropdownlist>
<Asp: button type = submit text = "Lookup" OnClick = "SubmitBtn_Click" runat = "server"/>
<P>
<Asp: label id = "Message" runat = "server"/>
</Form>
</Center>
</Body>
</Html>
Now let's take a look at the differences between the ASP + program and ASP. First of all, you may notice that the script delimiter of asp is missing, replaced by <script language =...>, To be honest, this is what I hate most, especially when mixed in HTML, it is not like a programming language, you need to see from such a piece of program flow, it is more difficult than login, now it is better. Of course, this is not to say that you cannot use it now. After all, it is forward-compatible with asp, but I still try to use it as little as possible. See the following section:
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