在asp.net中回发后保留锚点 [英] Retain anchor after postback in asp.net

查看:294
本文介绍了在asp.net中回发后保留锚点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用尾声滑块,例如在我的一页上创建.自然,回发后锚("#currentTab")信息会丢失.这很烦人,因为当您按下某个选项卡上的按钮时,您总是在回发后总是出现在第一个选项卡上.

I'm using a coda slider like consctuct on one of my pages. Naturally, the anchor ("#currentTab") information is lost after a postback. This is annoying because when you press a button on a certain tab, you always end up on the first tab after the postback.

让这些信息保留回发的最佳方法是什么?

What is the best way of letting this information survive a postback?

推荐答案

以AJAX请求的形式执行回发,或者将一些JavaScript添加到将锚定值发送到服务器的表单中

Either execute your postback as an AJAX request, or add some javascript to the form that will send the anchor value to the server

粗略的例子

<form onsubmit="this.anchor.value=top.location.hash">
    <input name="anchor" type="hidden" value="">
    <!-- rest of form -->
</form>

然后,您将需要一个约定以将其返回给客户端并执行适当的操作.

Then you'll need a convention to return it to the client and perform the appropriate action.

这篇关于在asp.net中回发后保留锚点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆