Recently a friend asked me, where can learn asp+, I have already said NGWS with the document is the best learning manual, but because NGWS requirements too high, and its size (110M) problem, there are some brothers, can not install it, I give you a site http:// www.aspnextgen.com/quickstart/aspplus/ , the above document is NGWS directly with, and this site is all built by asp+, you can directly see the implementation of ASPX, The only thing I'm dissatisfied with about our site right now is that we can't execute aspx, and we can't show you the routines ' results.
Well, let's not say much, we'll take a look at how to use the controls in asp+.
There are two types of controls in the asp+, one is the HTML control (HtmlControls) and the other is the Web control (WebControls), which we'll talk about in simpler HTML controls. The other control is left to the next section to say: HTML controls, if you just look at the look and find the same as plain HTML tags,
<select><a>
These dongdong, the only difference is that in the back of the tag more than a runat= "server", in fact, we are not unfamiliar to this runat= "server", Oh, in the ASP's Global.asa files we often see. But if you have this in asp+, then the nature of the program code has changed. Such as:
<select id= "ASPCN" >
<option>ASP</option>
<option>JSP</option>
<option>PHP</option>
</select>
The select above is just an ordinary HTML tag, but if you add runat= "Server" to the Select, everything changes.
<select id= "ASPCN" runat= "Server" >
<option>ASP</option>
<option>JSP</option>
<option>PHP</option>
</select>
So this is a asp+ program, and we can write an ASPX program. Such as:
<% @ import namespace= "System.Data"%>
<script language= "C #" runat= "Server" >
void Aspcn_onclick (Object Src,eventargs e)
{
String Selectvalue;
if (Page.IsPostBack)
{
SELECTVALUE=ASPCN. Selecteditem.value;
Selectitem.text=selectvalue;
}
}
</script>
<body>
Please select:
<form runat= "Server" >
<select id= "ASPCN" runat= "Server" >
<option>ASP</option>
<option>JSP</option>
<option>PHP</option>
<option>ASP+</option>
<option>COM</option>
</select>
<asp:bottun text= "Submit" >
<br>
Your selected select list is: <font color=red><asp:label id= "SelectItem" text= "no" > </font>
</form>
The above is a very simple ASPX example, the main purpose of which is to demonstrate the use of the Select HTML control. In the example above, the first display is as follows:
Please select:
AspJspPhpasp+Com
Your selected select list is: No
When you click the "Submit" button, you will be followed by: (assuming we choose PHP)
Please select:
ASP JSP php asp+ COM
Your selected list of select is: PHP
From the example above we can see that our main operation is the Aspcn_onclick subroutine, which is fired by a control named Sub. (the button and label are all Web controls, we'll talk about it in the next section), we are very familiar with the operation of the select control named ASPCN in Aspcn_onclick, hehe, is not very similar to the client's javascript?! Believe that the use of JavaScript brothers, must be able to understand the program, oh, we write server program is not like in the Write client program, m$ launched. NET is to achieve this effect, but this for beginners is a bad thing, because beginners are not clear what is the client what is the server, and now write them together, I believe a lot of people want to make a paste, so I began to suggest that beginners or first look at some of the basis of dongdong as well.
We use ASPCN. Selecteditem.value to get the value of the ASPCN list, and then pass Selectitem.text=selectvalue this value to the control named SelectItem. It becomes the situation we see. The program is very simple, we are here just let everyone have a preliminary understanding.
almost every HTML tag, plus a runat= "server", can become an HTML control. Specifically:
HtmlAnchor htmlbutton HtmlForm htmlgenericcontrol
HtmlImage HtmlInputButton (Button) HtmlInputButton ( Reset) HtmlInputButton (Submit)
HtmlInputCheckBox htmlinputfile HtmlInputHidden htmlinputimage
HtmlInputRadioButton HtmlInputText (Password) HtmlInputText (Text) htmlselect
HtmlTable HtmlTableCell HtmlTableRow HtmlTextArea
I can not use their usage for a moment, please everyone to the site I said to see themselves, we will be proficient in writing programs using HTML controls and Web controls. As long as e-wen, I believe there is no problem, oh, do not expect to fly my translation ah, my head is big, everyone spared my life.
In addition, we would like to remind everyone that, because we write asp+ generally use C #, so when naming the control attention to case, otherwise compile error. Then there is if the program compile, please carefully optimistic about the error message, do not immediately think of a mistake to ask, the use of their own brains to think, the harvest will be greater. Oh, this chapter is here, the next section will talk about Web controls.
(First of all, I have arranged a little, oh, finish the Web control, then talk about bind, then the database, followed by application and session, and then later to arrange)