A radiobutton list and a repeater are in an updatepanel. The repeater is using a jQuery tools plugin - scrollable.
radiobutton列表和转发器位于更新面板中。转发器使用jQuery工具插件 - 可滚动。
The scrollable plugin works after the initial page load. It does not after I click on a radio button.
可滚动插件在初始页面加载后工作。我点击单选按钮后没有。
I put in an input button to run the script below after a partial postback and the scrollable functionality works after I click it, so I'm guessing after the radio button click/partial postback, the javascript below that is needed by scrollable isn't being run.
我输入一个输入按钮以在部分回发后运行下面的脚本,并且在我点击它之后可滚动功能正常工作,所以我猜测单击按钮点击/部分回发后,可滚动所需的下面的javascript不是正在运行。
The scrollable plugin requires this:
可滚动插件需要这样:
<script type="text/javascript">
$(function() {
$("div.scrollable").scrollable({
size: 3
});
});
</script>
How do I run this after the radiobutton click? Or is there an alternate way to get this script to run after a partial postback? I don't want to do a full postback to remedy the problem.
如何在单击无线电按钮后运行此命令?或者是否有另一种方法可以在部分回发后运行此脚本?我不想做一个完整的回发来解决问题。
Thanks in advance.
提前致谢。
1 个解决方案
#1
10
Scrollable is not working after the partial postback because that portion of the page is re-rendered but the page is not loaded again (your javascript is not run). You can register a function to run when the partial post back completes and call scrollable from there to ensure it continues to work after the partial postback.
部分回发后Scrollable不起作用,因为页面的那部分被重新渲染,但页面没有再次加载(你的javascript没有运行)。您可以注册一个函数,以便在部分回发完成后运行,并从那里调用可滚动,以确保它在部分回发后继续工作。
$(function() {
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args) {
$("div.scrollable").scrollable({
size: 3
});
}
});
#1
10
Scrollable is not working after the partial postback because that portion of the page is re-rendered but the page is not loaded again (your javascript is not run). You can register a function to run when the partial post back completes and call scrollable from there to ensure it continues to work after the partial postback.
部分回发后Scrollable不起作用,因为页面的那部分被重新渲染,但页面没有再次加载(你的javascript没有运行)。您可以注册一个函数,以便在部分回发完成后运行,并从那里调用可滚动,以确保它在部分回发后继续工作。
$(function() {
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args) {
$("div.scrollable").scrollable({
size: 3
});
}
});