asp+ Learning Notes 1

Source: Internet
Author: User
Tags object comparison garbage collection string zip client
Asp+| Notes is in fact the SDK in the document, only to see the translation of some of the knowledge points out. Because my habit is
On paper, you can write two ballpoint pens, 5555~~~.

First, geting started

。 High performance, asp+ is compiled into NGWS run-time code, early-fix, JIT-compiling, caching technology
。 development tool support, WYSIWYG editing environment
。 Powerful and flexible, based on NGWS runtime environment, rich support library, message mechanism, data access, language
Independent and compatible with existing COM systems
。 Simplicity, deployment and cultivation, separation of presentation and logic layers, automatic garbage collection
。 Easy management, text file configuration, achieve "0 management", can even overwrite the running compiled
The code.
。 Good scalability, high availability, clustering, multiprocessor
。 Customizable, scalable, arbitrary subclass of existing classes, to achieve customized user witness and state services
。 Security, integration with systems, security assurance based on application

Language support, asp+ already built in three, c#,vb,jscript
Cases:
Attribute definition:
Public String name{
get {
.....
return ...;
}
set {
. = value;
}
}

Event handling:
void MyButton_Click (Object Sender,eventargs e)
{
...
}

Styling (that is, forcing type conversions, but unlike the tip, see Java):
MyObject obj = (MyObject) session["somevalue"];
Imyobject Iobj=obj;

Name space:
Using System;

Main method:
public static void Main (string[] args)
Note that args in C #, like Java, does not contain the executable file itself.


Second, asp+ Web Forms

1). Introduction
asp+ Web Forms is a programming model for dynamically generating Web pages on the server side, based on NGWS running
Time environment.
。 Reusing UI controls to reduce the amount of programming
。 Clear page Logic
。 Powerful editing tools

asp+ WEB Forms is a file with the. aspx suffix, compiled into a NGWS class, and compiled only once.
Method One, convert an ordinary HTML file suffix to. aspx
Method II, use <%%> code block
But the above is not recommended practices, not conducive to the separation of logic and performance.

。 asp+ server Control
In the aspx file, the tag that contains the attribute Runat=server
server controls generate HTML code at run time.
server controls automatically maintain the client input, the program does not have to deal with customer input, and not in the customer
End-Write script (note that the server does not save the data on the server, but through a hidden
Domain to work on).

。 Handling Events for server controls
Yes, note that these events are actually happening on the client, but you don't have to, just when you're in a VB
The control in the form writes an event handler.
。 Using a custom server control
asp+ with 45 built-in server controls, or you can write yourself
。 Data Help Set
Built-in DataGrid and other controls, they support templates
。 Form validation Control
Many validator are made, and you can enforce that you must enter content for one field, and so on.
。 Code-behind
can be entered without implementation code and performance separation

2). Using server controls
Runat=server
can have attributes
can have an event
<asp:hyperlink runat= "Server" > Implementing page Navigation
Page.navigate (URL) can also implement page navigation

3. Add style to server controls (CSS)
You can control it like CSS, and you can use a style object, for example:
Style style=new style ();
Style.bordercolor = Color.Black;
...
Mylogin.applystyle (style);

4). Form Validation
Validation controls are valid only for a subset of the controls:
HtmlInputText value
HtmlTextArea value
HtmlSelect value
HtmlInputFile value
TextBox Text
ListBox SelectedItem
DropDownList SelectedItem
RadioButtonList SelectedItem
There are several validation controls:
RequiredFieldValidator, must fill in the contents
CompareValidator, comparing the values of a constant or another control
RangeValidator, scope validation
RegularExpressionValidator, compare with one mode, use for email, ZIP code verification
CustomValidator, customizing conditional validation
ValidationSummary, displays a summary of the error message after validation
If the client supports DHTML, the validation control will automatically generate a client-side validation script, otherwise, etc.
After the server on the server side of the neat.
The Page object has a IsValid property and is set to False if the validation fails, and the
The ValidationSummary control (if any) automatically displays an error message.

。 CompareValidator
The control has three properties, Controltovalidate,controltocompare,operator, that represent the
The validated control, the value of the comparison, and the comparison method.
。 RangeValidator
Three properties: Controltovalidate,miniumcontrol,maxiumcontrol
。 Regular
Two key properties: Controltovalidate,validationexpression
Cases:
<asp:regularexpressionvalidator id= "Regular1" runat= "Server"
Controltovalidate= "TextBox1"
validationexpression= "^\d{5}$"
display= "Static"
Font-size= "10pt" >
Zip code must be 5 digits
</asp:RegularExpressionValidator>
。 Custom validation
Need to customize a function, if placed on the client, the function must use ClientValidationFunction
property specifies that the function has a format:
function Myvalidator (source,value)
Source is the CustomValidator object.
If on the server side, it is written in the event handler function: Onservervalidationfunction
Cases:
<script language= "C #" runat= "Server" >
BOOL ServerValidate (Object source,string value) {
...
}
</script>
<asp:customvalidator id= "Customvalidate" runat= "Server"
Controltovalidate=&quo

[1] [2] Next page



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.