.NET 2.0 data Source Control
ASP.NET 2.0 with various types of source control. These controls are suitable for dealing with different types of data. These controls include:
SqlDataSource control allow connectivity to most relational database. Controls the Sql database name can understand the Sql language. It contains almost all the data in relation format preservation of the database. Note that not only the Sql database management system Microsoft Sql Server. SqlDataSource database management system. SqlDataSource control using a provider (providers), these providers in different types of special database. The default is Microsoft SQL Server providers. Another provider is Oracle. Both are managed code (write) took code is in the.net Framework, the most robust provider. ASP.NET 2.0 contains another can and all other OLEDB driven by the database communication OLEDB provider (Object Embedding and is to Databases for the initials). Because it is a standard, the OLEDB include almost all other database management system, including IBM for DB2 and SAP. SQL, However, the OLEDB connection with hosting provider not code. This means that it is not fully comply with all requirements of.net technology, but still can be in.net work. We can expect more data controls will release third-party providers, and can be expected and they are properly managed code.
If you start writing more complex tasks, you will find OLEDB Data controls and not hierarchical structure of System.Data. These Controls in System.Web.UI.Controls namespace. But for most of the task, this problem will appear, you simply from sidebar drag-and-drop data controls.
AccessDataSource control is a special case of SqlDataSource control, it contains an optimized for Microsoft Access provider.
XMLDataSource control allow connectivity to XML data.
SiteMapDataSource control is a special form of XMLDataSource control, it controls for ASP.NET 2.0 Web applications of special structure is optimized.
Connect to your own ObjectDataSource controls to create business object.
Either a source control (if it is, then SqlDataSource either providers), they are all for ASP.NET 2.0 page activation of a group of behavior. This database includes a connection and activation of the data and behavior. These behaviors of data binding controls are available, they display data and receive input from a user.
If the old ASP is familiar, Then ASP.NET 2.0 data controls actually is equivalent to the ADO.NET an instance of an object. Therefore, ADO.NET provide data access technology. In most of the tasks of ADO.NET, create and operate the object is the top by comparing data control object automatically (and correct and efficient).
Briefly, data control created using data base structure required background. However, they are not create any Web page display in the data. Accurately, they can finish read data binding control data such as write data and behavior.
Data Binding Controls
Data binding control provides a source control and the link between the users. They gain source control data and behavior and to visitors on display. This division and cooperation is very effective. You can choose any source control and its link to any data binding controls. Besides, this small exceptions are a mixture of the match.
Data binding controls a package. For example, can show not only GridView control list of data, and provides the sorting, choose according to the page, click the switch that subset and for data editing state these functions. If need to expand these functions, can be in the event of exposure GridView control room code written.
For example, an XML data tree structure, so the best use of organization XMLDataSource controls access and Menu or TreeView control of data binding. Data in table SQL Server, so the access control by SqlDataSource on GridView or DetailsView display. List the types of data binding controls can show any type of data. Can be used alternately these controls to cross the data type, but they normally best according to the design target.
ASP.NET 2.0 has four sets of data binding controls. Because they are on the function, this chapter will overlap with some time to distinguish. First, you will see them, and then presents a comparison chart for yourself, and finally the target is to choose the right data binding controls.
Notice other controls, such as text box, also can undertake data binding. However, these separate control is the best way to a control mentioned in the template Settings to connect to the data.
In selecting data binding control will be confronted with some problems. Want to own a target right control is very difficult. In order to help you to finish this work, the following section will be divided into 4 groups data binding controls.
1.Form control
Although form control made significant improvement, but will still produce typical HTML forms, including more than lined up the data recorded. These controls that record, and will do more of one or more columns show for columns. In the form of GridView control structure of every unit shows a value (data). Repeater control and DataList control operate in the same manner, in a unit in all fields to display a record.
Provide the most GridView control actions, it can read and edit and select records. DataList control allows access and editing, and is a read-only Repeater control. This name DataList some puzzling, because there are a group of independent List control is used to select a record has been optimized. DataList control is used to display the data table.
2. The singles records show that controls
A single record control (DetailsView and FormView) display a record only. They can be a face on the cards. Whenever these cards are, but in a period of time inside can be placed in the top one. To see the downward browse to other cards. A single record control is to allow visitors to navigation capabilities, a record, to check for a specific records or directed to the first or the last record. When creating DetailsView control in provides some default layout, and create the FormView control in your layout of will create a blank panel. These two data binding controls are read, editing and create support new records.
3.Choices list controls
Choose a suitable list control users choice. The two control display only a field in each record for the mouse click museum. ListBox controls the default is launched, and spread it on user DropDownList before display only line. These controls can display, do not have the function of data.
4.Tree control
The visual applies to handle stored in the data nodes rather than watch. Provide automatic popup Menu control functions, when you move your mouse in a Menu options above when submenu will automatically. TreeView control allows users to open or fold node. Provide SiteMapPath control, the function can navigate tracking based on the current page automatically update this two controls.
Table 0-0 summarizes some of the Data Binding Control between its difference.
Table 0-0
Control | the Main Data Structure | Function | And That the Basic Purpose |
GridView | Table | Read Editor | Edit existing records In the table shows a number of records The value of each field has its own form unit Each show out of a field |
DataList | Table or Tree | Read Editor | GridView to create a new record In the form of a number of records show A unit equal to a record In a display unit in all fields |
Repeater | Table or Tree | Read-only | GridView to create a new record In the form of a number of records show A unit equal to a record In a display unit in all fields |
DetailsView | Table or Tree | Read Editor To Create | Create a new record Edit existing records Structure to provide default Records show that a single |
Continued Table 0-0
FormView | Table or Tree | Read Editor To Create | Create a new record Edit existing records Does not provide the structure of default Records show that a single |
DropDownListand ListBox | Table or Tree | Read-only | Listed a number of fields Waiting for the user to choose Data show that has been available for users to choose |
SiteMapPath | Tree | Read-only | Used to determine the current location of the site location Display page and the current page. The name between |
Menu | Tree | Read-only | Used to show menus, which will have a choice Show top node, can open a byte points each time |
TreeView | Tree | Read-only | For multi-display sub-node Show top-level node, you can start a multi-layer or sub-node |
Source Control and Data Binding Controls
ASP.NET 2.0 for data processing provides two groups: the data source control and control data binding controls. Source control processing of data connection and edit background, sorting, paging, etc. Data binding controls on page presents data and eventually will give users. Data display
These two groups control on type should match. Tabular-type of data binding controls, such as GridView and FormView from the table type of data should retrieve data control, such as SqlDataSource. Tree data binding from the XML data access control data. List controls can retrieve data from two kinds of data. Although such, but there are some exceptions. Some type of data to and form types of data binding controls are used together. This usually need a InfoPath statements, this sentence will limit the data read data from the tree.
Data binding controls must have an attribute data controls can be set to its source. In addition, for many, this pair of certain attributes control must be coordinated. For example, if you need to edit, data control must open the corresponding options, meanwhile data binding controls also must activate its editing functions.