Seven tricks (transfer) of the ASP.NET app

xiaoxiao2021-03-06  36

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.

Usage

In general, we are using ./../ This relative path to determine and plan our resources (such as pictures, resource files), but in this way, when we deploy the app, it may be wrong, If a picture is included in the .ascx control, the problem will appear when the control is quoted by the ASPX files we have in different levels.

~ / 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

There is often such a situation, we need to submit a form, but more than 500 in the form, the control or text box is to be filled, that is, the user needs to pull the IE scroll bar to fill it, then 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 the server side, then it means that the page will be submitted once, and when the user sees the refresh page, the page is determined in 3 / 1 The place is also the most beginning of the page. The user only drags the mouse, and then fill in the rest of the 250 controls, very unfortunately, 370 controls need him to choose?

Use the following method to quickly determine and remember where you are submitted.

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 StringBuilder

RegisterHiddenField ( "__ SCROLLPOS", "0") saveScrollPosition.Append ( "