方法一
前台:
<a id="s1" name="s1"></a>
后台:
ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('成功!');location.href='AAA.aspx#s1'", true);
方法二
如果锚点不好用,可以使用 TextBox1.Focus();
点某按钮的时候:
ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('成功!');location.href='AAAA.aspx?no=1';", true);
在 !IsPostBack里:
string no = Request.QueryString["no"];
if (no == "1")
{
TextBox1.Focus();
}
然后把这个TextBox1放在合适的位置,并把width设为0,BorderStyle设为:None,就看不见它了,还能跳转到合适的位置。