点击按钮刷新页面定位到当时的位置
2016-03-25 09:20
218 查看
方法一
前台:
<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,就看不见它了,还能跳转到合适的位置。
前台:
<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,就看不见它了,还能跳转到合适的位置。
相关文章推荐
- Storm集群组件和编程模型
- C#Winform子报表功能
- 畅通工程——D
- Maven添加本地Jar包
- poj 1159 dp Palindrome
- Git学习
- 云盘秒传 优劣
- [iOS]真机调试:could not find developer disk image
- LearnMVC5-AddAView
- 数据工程师常用的 Shell 命令
- 初识框架
- Android系统架构学习笔记
- 案例分析:个人所得税计算办法
- HiveQL学习笔记
- eclipse开发安卓时logcat的绿色加号不见了
- eclipse开发安卓时logcat的绿色加号不见了
- 3月24日学习笔记
- 求最短路径的三种算法: Ford, Dijkstra和Floyd
- poj The Perfect Stall 1274 (二分图最大匹配)
- 《鬼泣》连招攻击动作分析总结