Msdn: ASP. NET 2.0: discard the DataGrid. There is a new grid control!

Source: Internet
Author: User
Today, I saw this article on msdn, introducing the new data control dataview of ASP. net2.0. The DataGrid of ASP. net1.x is very convenient in simple and fast display of Data lists. If you consider the appearance of the interface, it is difficult to control it. You still need to write a lot of code. Sometimes there are some inexplicable problems. In ASP. net2.0, all controls, regardless of their actual implementation process and user interface features, are derived from the same base class (basedataboundcontrol class. The right figure shows the new class relationship diagram. However, apart from the newly added gridview and menu controls, several other data list controls are the same as the control inheritance tree of ASP. net1.x. However, the repeater has been changed to inherit from webcontrol, that is, it also inherits the style and attribute of webcontrol. Will some HTML elements be generated during render? It is also mentioned that the gridview control also supports the traditional binding mechanism based on the datasource attribute and the databind method. Although this binding mechanism is fully supported, such programming practices are not encouraged .. The net2.0 framework provides a new data source control, which is a group of data source controls. net Framework class, which facilitates two-way binding between data storage and data binding controls. Obviously, this control provides the main data operation functions for selecting, inserting, updating, and deleting data, describes the process relationships.

This data source control forms an intermediate layer between the data binding control and the data source, and also exposes a public interface idatasource that provides basic operations, operations on the data source are performed by combining the selectcommand, updatecommand, insertcommand, and deletecommand attributes of the control. The gridview defines an internal handler for these events.

<Asp: sqldatasource runat = "server" id = "mysource"
Connectionstring = "Server = (local); database = northwind; Integrated Security = sspi ;"
Selectcommand = "select * from employees where employeeid> @ minid">
<Selectparameters>
<Asp: controlparameter name = "minid"
Controlid = "empid"
Propertyname = "text"/>
</Selectparameters>
</ASP: sqldatasource>

However, you still need to write code for complex data operations. What is the performance when the data volume and traffic volume are large at the same time? This is still a noteworthy issue.
In the gridview object model, there is a new feature that is worth the experience-using a callback-based lightweight mechanism for sorting and paging, enabling and disabling this feature by setting the enablesortingandpagingcallbacks Boolean attribute. When you click the sort or paging link to enable callback, The gridview requests the sorting data or the next page without sending back the visible page. There is a round-trip process, but there is no page refresh. You only need to enable the allowpaging and allowsorting attributes to enable the automatic flip sorting and paging functions. Is this sorting a single-page sorting or an entire data source sorting? This is a good user experience. In ASP. net1.x, if you want to put radiobutton in the DataGrid, the checkbox requires a lot of code. The gridview has implemented this function and improved the URL multi-parameter problem of hyperlinkfield. In addition, it is interesting that imagefield, which uses the ASP. NET 2.0 dynamicimage control to display images from both databases and URLs. In editing mode, a browse button is displayed in the imagefield column to locate the new local file to be uploaded. The syntax of the Data Binding expression is more concise. You only need to call the new eval protection method defined by the page class, and you only need to input a string parameter of the data field name. On the surface, this seems to simplify the work of programmers. These functions can be implemented in 1.x, but a lot of code is required.
ASP. net2.0 has made a lot of improvements on server controls. The data binding control syntax is simpler but more powerful. As mentioned in the article: Ideally, they should provide advanced functions with few click operations and a limited number of code. However, for complex page interactions and more complex data operations, these controls still cannot meet the requirements and require a lot of code.

The promotion activities of vs2005 team system with msdn on the msdn Chinese site are in full swing, but no messages of the Simplified Chinese version have been published. When will the Chinese version of msdn be available? Looking forward ......

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.