Seven tricks for the Asp.net application

xiaoxiao2021-03-06  67

Seven tricks for the Asp.net application

As Microsoft .NET is popular, ASP.NET is increasingly accepted by the majority of developers. As a developer of ASP.NET, we not only need to master the basic principles, but also more practice, from practice to get real development skills. In our actual development, it is often necessary to meet the development needs. We have to accumulate some development techniques. This article introduces some practical skills to you, hoping to benefit everyone. 1. The usage is generally, we are using ./../ This kind of relative path to determine and plan our resources (such as pictures, resource files), but in this way, when we deploy applications, it may Will be wrong, and if a picture is included in the .ascx control, the problem will appear when this control is quoted by the ASPX files we have in different levels of directory. ~ / Image / about.bmp is a very good way to start the point as the root of the web application, so that it is more flexible and convenient than you ./Image/about.bmp is more flexible. There is a little bad, this way is dynamically parsing when the ASP.NET is running, so in the IDE design mode, you may not preview it. 2. After refreshing and submitting the page, save your page scroll bar often have such a situation, we need users to submit a form, but more than 500 in the form, the control or text box is to be filled, that is, the user The scroll bar that needs to be pulled to the IE can be filled, so if the user is visible to 2/3 of the IE range, the value of a combo box is selected. Unfortunately, the combination box is the server side, then it means that the page will be submitted once. When the user sees the refreshing page, the page determines that the place in 3/1 is to display the first place in the page, the user only drags the mouse, and then then fills the remaining 250 controls, then Unfortunately, 370 controls need him to choose? Use the following method to determine and remember the position before you submit. Online Old Dog Learns New Tricks also has a similar example. MAINTAIN SCROLL POSION IN ANY Page Element, but he used Web Behavior this means you need a .htc file

Private Sub RetainScrollPosition () Dim saveScrollPosition As New StringBuilderDim setScrollPosition As New StringBuilderRegisterHiddenField ( "__ SCROLLPOS", "0") saveScrollPosition.Append ( "