Bounce in the BS system, positioned to the object

zhaozj2021-02-16  114

How to locate the object hbzxf in the B / S system http://blog.9cbs.Net/hbzxf/

When developing the B / S system, due to the problem of the page, it is often caused to automatically scroll to the beginning. However, sometimes we need to return to the page after refreshing. In order to solve this problem, I wrote a method. You can see it, in fact, it is not a high degree of practice, but at least solves some problems.

The principle is to add an object control in the location you need, let the page are refreshed to locate the position of this control, use the scrollintoview method.

public void ScrollToObject (string str_Ctl_Name, Page page) {if (! page.IsStartupScriptRegistered ( "ScrollObject")) {page.RegisterStartupScript ( "msgScrollObject", "