Asp.net自动定义控件在页面中的定位

自己建立了一个控件,上面有显示、隐藏此控件的按钮,现在要当按下这两个按钮时,就定位到此控件的位置,方法如下:

步骤1、在控件的“源码”中加入锚点:

<name="anchorMaintain" id="anchorMaintain"></a>
步骤2、
        string script = "<script>function window.onload(){window.location.href='asAnchor';}</script>";
        
this.Page.RegisterStartupScript("asAnchor", script);
这样单击按钮就可以定位到锚点
原文地址:https://www.cnblogs.com/scottckt/p/1345025.html