As we all know, under ASP.NET 2.0, microsoftware provides a system of new controls, some of which are quite useful, such as the Membership member management system and the step-by-step wizard controls, which save us a lot of time. In addition, Some, such as the Gridview upgraded from Datagrid, sometimes don't feel so good.
While this control provides us with great convenience, it also loses flexibility. For example, directly specifying a SQL statement can complete the data access work, and paging display and sorting are even simpler than eating. As we all know, this is contrary to our layered logical architecture design, which creates an embarrassing situation. It is difficult for novices to make powerful and complete programs just by relying on these controls. What's more, it encapsulates There are a lot of operations, and we don't know how it works in the background. For novices, if something goes wrong, they have no idea where the problem lies, while experienced programmers will definitely not adopt such an ugly design. When we use it to complete upgrades and other operations, we will require verification of the input content, which is also inconvenient. When the control is running, it will generate a huge ViewState field, causing a decrease in efficiency. As for the paging performance under large data volumes, it is even more inconvenient. Having said that, although DataSet can now be binary serialized, the results are still unsatisfactory. Then we have to ask what is the value of such a control?
Although GridView can do paging, the paging styles it provides are limited, and it is very troublesome to define manually. Then again, if you need very powerful data operations, such as multi-column sorting, summarization, export, totaling, or even drag and drop, etc., it is better to use other means to achieve it, such as business controls and the use of smart client platforms. More convenient. The design of GridView's dozens of style attributes is also very poor. Although you can use these attributes to make a very fancy user interface, once a project has dozens of GridViews, the work to modify is simply unimaginable, so we You have to use a powerful tool like CSS to define its style.
Equally useless is the SQL data source control, which makes programming so simple. Although it has no practical value in large-scale projects, I think it still has certain benefits. At least it can improve the level of interest in programming without being too high. people's confidence, I think back then I used DW's automatic coding function like a blind man to make a personal website for fun. Although the code it generated was so ugly and the logic was so confusing, I later relied on my full enthusiasm I would not be where I am today if I was passionate about programming.
What I am more optimistic about is the data source control called ObjectDataSource. Why? It can freely control the program logic in the background, making every step of the operation very transparent. In addition, it uses the powerful features provided by generics to make our program look like It feels good. The data source saves a lot of time for our front-end data binding work. Making good use of this feature can bring a lot of convenience to our programs.
Friends who are familiar with Microsoft's StarterKit know that there is a sample program for a personal website, which is a typical example of object data source application. In this program, it can be said that the new control features provided by ASP.NET 2.0 are fully utilized. A lot of logic work is completed with a small amount of code. But after all, it is just a personal website, and the work in many places is not enough. For example, I can submit an empty form, and it does not perform any checks.
In short, rational use of these new controls will greatly improve efficiency, and also give friends with low programming skills a chance to experience a sharp new C# experience. From a functional point of view, I personally think it is much better than the three-legged cat trick of DW. Many people are still discussing how to program under DW, which is really inappropriate. DW is more suitable for interfaces.
Regarding the paging issue, I am currently working on a paging control under ASP.NET 2.0. Generally speaking, it is an upgrade and transformation based on MSDN SQLPAGER in 1.1. First, the program is migrated to 2.0, and second, it is completed. In the form of user controls, the paging style can be freely expanded according to your own preferences, and you can use the data access block of Microsoft's latest enterprise library to communicate with the database. You can use data caching or only read the required records, which improves efficiency. . It has been basically completed and will be released on the new day. Everyone is welcome to pay attention. At the same time, due to the limited level and energy, there will inevitably be some deficiencies and shortcomings, but don't worry, this control is developed with source code, you can freely expand it, and if there are problems, you can also check and correct them from the source code.
Regarding the issue of big data paging, I saw something by a foreigner on the Internet today that seemed quite interesting. I will take some time to translate it and dedicate it to everyone. Here is the source address. The general idea is to use the ROW_NUMBER() feature of SQL SERVER 2005. Come to work.