I have been using asp for development before. ASP is not as smart as asp.net, but it allows us to understand the essence of web development, such as the principle of HTTP POST request and GET request. In addition, if you upload a file, you need to set the enctype attribute of the form, etc. I think ASP.NET is more stupid than smart. When I first learned ASP.NET, because Microsoft vigorously promoted the advantages of server controls, there was a misunderstanding that when writing ASPX pages, you should try to use server controls. If you use HTML controls, it will feel unprofessional. However, after using it, I found that it is not easy to control its appearance. If you want to perform DOM operations, you need to reference its clientId attribute, which is far from directly operating HTML. In addition, it will generate some unnecessary code, which makes me feel very uncomfortable.
The advantage of using server controls is that you can call it by ID in the server-side background code (*.VB/*.CS) and program it. If you do not need to programmatically access it on the server side, you should try to avoid using server controls, because server controls will eventually generate HTML tags, and when processing server controls, they need to be compiled and generated into corresponding HTML, which will increase the server load and cause The performance of the page is reduced. Therefore, server controls should be avoided when HTML tags can be used directly. Server controls just provide a way to convert dynamic HTML into server controls. This is actually very similar to ASP. It can also be achieved through template classes in ASP, but this kind of work requires you to manually write code to implement it.
When using gridview, a lot of garbled characters are generated, which is the so-called viewstate. On the one hand, it takes up a lot of network bandwidth, and on the other hand, it affects the simplicity of HTML. Therefore, if the update, delete, and add functions you are not using are just for displaying data, you should turn off its viewstate. You can also disable it directly in the web.config file. The following code demonstrates how to disable viewstate in the web.config file.
<pages enableViewState="false">
.....
</pages/>