I. Memory Web-side controls need to mate with form elements in HTML
Label-compiled into <span> in HTML
Literal-compiled into null in HTML
Text class
- text box <input type= "text" > TextBox
- Password box <input type= "Password" > TextBox properties textmode= "Password"
- Text fields <textarea> TextBox properties Textmode= "Mutilline"
- Hide Text field <input type= "Hidden> hiddenfiled
Button class
- Normal Pushbutton button No
- Submit button (default commit)
- Reset button Reset None
- Image Button Image ImageButton
Select Class
- Radio RadioButtonList (This is not a panel, each default is a set, there are many items) property ListItem Enable selected Text Value
- CheckBox CheckBoxList (This also does not use a panel, each default is a set, there are many items) property ListItem Enable selected Text Value
- Select option DropDownList
- File (not learned)
Two. Data binding
1.Foreach Traversal (recommended)
//Binding National InformationList<nation> Li =NewNationdata (). Selectnation (); foreach(Nation Iinchli) {ListItem Li=NewListItem (); LI. Text=I.nationname; LI. Value=I.nationcode; if(LI. Value = ="N001") {LI. Selected=true; } DLNATION.ITEMS.ADD (LI); }
2.
Three. Questions about binding Data refresh
Data option cannot be changed when binding data is present
Page_Load event will be executed every time the page refreshes
It will rebind the data once and then execute the button event.
Determine whether a page is first loaded or responds to a postback
if (!ispostback)
{
Only the code that executes when the page is loaded the first time is written in this area.
Note that 95% of the code is written in this area.
! Event delegate cannot be written to this side
}
Four. Page Pass value
Value of Value-Cross page pass value
Querystring-url pass value, address value
Pass value: [Address? Key=value&key=value]
Take out the value passed by the URL.
Value: String value = request["Key"];
Five. C # service-side jump page
Response.Redirect ("url");
Web-side controls, page-pass values