Seven tricks for designing ASP. NET Applications
With the popularity of Microsoft. NET, ASP. NET is increasingly accepted by developers. As a developer of ASP. NET, we not only need to master the basic principles of ASP. NET, but also need to practice more and get real development skills from practice. In our actual development, the basic principle is often unable to meet the development requirements. We need to accumulate more development skills. This article will introduce some practical skills to you, I hope it will be helpful for everyone's development.
1 .~ Usage
In general, we use. /.. /This relative path is used to determine and plan our resources (such as slice and resource files). However, in this way, errors may occur when we deploy the application. if an image is included in the ascx control and the control is referenced by the aspx files in two directories at different levels, the problem will occur.
~ /Image/about.bmp is a very good method. It takes the root directory of the Web application as the starting point, so that it is better than you. /image/about.bmp is more flexible and convenient. This method is used for dynamic parsing during ASP. NET runtime, so you may not be able to preview it in IDE design mode.
2. After the page is refreshed and submitted, save the position of the page scroll bar.
This is often the case where you need to submit more than 500 forms? The control or text box must be filled in. That is to say, the user needs to pull the IE scroll bar to complete the filling. If the user is visible at 2/3 of the IE range, the value of a combo box is selected, unfortunately, the combo box is on the server side, which means that the page will be submitted once. When the user sees the refreshed page again, the page is determined to be in the place where 3/1 is displayed at the beginning of the page. The user only needs to drag the mouse and then fill in the remaining 250 controls in the place just now. Unfortunately, which of the following controls needs to be selected?
The following method can be used to quickly determine and remember the location before your submission.
The Old Dog Learns New Tricks on the Internet also has a similar example Maintain Scroll Position in any Page Element, but it uses Web Behavior, which means you need to use a. htc file.
Private Sub RetainScrollPosition ()