----------------------------------------------
Command usage for repeater:
1. ItemCommand event-All the controls in the repeater that can trigger an event will execute this event
2, CommandName-random name, in the background event in accordance with the names to distinguish which function button you pressed
3, CommandArgument-event data, usually placed primary key value, in the background using e.commandargument to get primary key data
------------------------(below Ma Qingxin)----------------------------------
Repeater controls and DataList controls that can be used to display a set of data items at one time. For example, you can use them to display all the rows in a data table.
The Repeater control is fully template-driven, providing maximum flexibility and the ability to set its output format arbitrarily. The DataList control is also driven by a template, and unlike Repeater, the DataList default output is an HTML table that DataList records from the data source as cells in the HTML table.
1. Repeater Control display Data
To display data using the Repeater control, you must create a ItemTemplate.
----through the browser can see,. NET does not change the structure inside the template, how to arrange, data display also how to display.
-----So, repeater flexibility on this, completely free to play, how to show how to display.
2. Using templates in Repeater
Repeater supports the following 5 types of templates
ItemTemplate: Format Each data item "Formats every item from the data source."
AlternatingItemTemplate: Formatting alternating data items
SeparatorTemplate: Formatting separators
HeaderTemplate: Formatting the header
FooterTemplate: Formatting the footer
Above, the English use of formats item from datasource such words, the repeater control is mainly used to format the data, how to arrange the control data, how to display.
Repeater must use ItemTemplate, other types of templates are added on demand.
3. Event handling for Repeater controls
The Repeater control has the following events:
triggered when a Databinding:repeater control is bound to a data source
Triggers when an event is triggered by a child control in a Itemcommand:repeater control
ItemCreated: triggers when creating repeater per item
Triggers when each item of the Itemdatabound:repeater control binds data
----repeater controls are flexible enough to iterate over tables and to iterate over other content such as Div
-------------------------------
Command usage for repeater:
1. ItemCommand event-All the controls in the repeater that can trigger an event will execute this event
2, CommandName-random name, in the background event in accordance with the names to distinguish which function button you pressed
3, CommandArgument-event data, usually placed primary key value, in the background using e.commandargument to get primary key data
-----------------------------------------
First, Response object
1. Definition: Used to send data from the server will be the browser. It allows the data to be sent as the result of the request to the browser and provides information about the response, and it can be used to enter data in the page, jump on the page, and pass the parameters of each page. It corresponds to the response message of the HTTP protocol.
2. Common Properties:
Common Properties for response controls
Property |
Description |
Buffer |
Gets or sets a value that indicates whether the output is buffered and sent after the entire response has been processed |
Cache |
Get caching policies for Web pages, such as expiration time, privacy, and change clauses |
Charset |
Sets or gets the output character encoding for HTTP |
Expires |
Gets or sets the number of minutes before a page that is cached on the browser expires |
Cookies |
Gets the collection of cookies for the current request |
IsClientConnected |
Returns whether the client is still connected to the server |
Suppresscontent |
Sets whether to send HTTP content to the client browser, if true, the Web page will not be passed to the client |
3. Common methods:
Common methods for response controls
Method |
Description |
AddHeader |
Speaking of an HTTP header added to the output stream |
AppendToLog |
To add custom log information to the IIS log |
Clear |
Clears the contents of the buffer |
End |
Sends all the contents of the current buffer to the client and then shuts down |
Flush |
Sends all data in the buffer to the client |
Redirect |
To re-orient a webpage to another address |
Write |
outputting data to the client |
WriteFile |
Writes the specified file directly to the HTTP content output stream
|
Usage of 7.19 Repeater: