__doPostBack()之后的回调?
我通过调用如下方法使用 Javscript 刷新 UpdatePanel:
reloadDropDown = function (newValue)
{
__doPostBack("DropDown1", "");
selectNewValueInDropDown(newValue);
}
在我的 UpdatePanel 内部有一个
I am refreshing an UpdatePanel with Javscript by calling a method like so:
reloadDropDown = function (newValue)
{
__doPostBack("DropDown1", "");
selectNewValueInDropDown(newValue);
}
Inside my UpdatePanel is a <select>
box that I need to select an <option>
with a newValue. My problem is that my selectNewValueInDropDown
method is being called prior to the __doPostBack
from completing. Is there a way I can "wait" for the postback before calling my selectNewValueInDropDown
method?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为了使我的评论更具体,我的想法是:
当然,您可能想要处理两个请求重叠的竞争条件。为了处理这个问题,您需要跟踪哪个处理程序针对哪个请求。您可以在服务器端使用诸如 ScriptManager.RegisterDataItem 之类的内容,或者调用 args.get_panelsUpdated() 并检查您感兴趣的面板是否已更新。
To make my comment more concrete, here's the idea:
Of course, you probably want to handle race conditions where two requests overlap. To handle that, you would need to keep track of which handler is for which request. You could use something like
ScriptManager.RegisterDataItem
on the server side, or callargs.get_panelsUpdated()
and check to see if the panel you're interested it was updated.