在下拉列表中再次调用java脚本选择索引更改 [英] call java script again at dropdown selected index change

查看:85
本文介绍了在下拉列表中再次调用java脚本选择索引更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个DropDowns:



DdlState和DdlCity,



我提供特殊设计和使用java脚本和css为他们两个工作,



和选择州后,



Ddlcity DropDown是绑定的,

它运行正常,





但现在的问题是:

i使用更新面板,

以避免页面刷新(当城市根据状态绑定时),



此城市正确绑定后但我的DropDown风格和特殊工作停止工作,



所以我需要再次调用java脚本和css,我放在页面Load,

那么如何在Dropdown Bind中调用这些java脚本,



脚本是:

i have two DropDowns:

DdlState and DdlCity,

And I Provide Special Design and working to both of them using java script and css,

and After Selection Of state,

the Ddlcity DropDown is bind,
It work fine,


But Now problem is:
i use update panel,
to avoid page refresh( when city bind according to state),

After this city Bind Correctly but My DropDown "Style And Special Working Is Stop Working",

so I thing i need to again call the java script and css, which i put at page Load,
So how can I call these java script at Dropdown Bind,

The Script are:

<script src="ServerJs_and_css/min_1.7.1.js" type="text/javascript"></script>
<script src="DropDownNew_jquery/chosen.jquery.js" type="text/javascript"></script>
<link href="DropDownNew_jquery/chosen.css" rel="stylesheet" type="text/css" />













问题2:



i face同样的问题时间:



我有一个图像滑块绑定Accroding到Dropdown,

当我使用Update Panel然后选择Dropdown绑定图像滑块jquery时,

然后数据正确显示但是

图像滑块停止工作,



这次Java脚本是:< br $> b $ b







Problem 2:

i face The same Problem When:

I have a image Slider Which bind Accroding to Dropdown,
And When I use Update Panel And Then Select Dropdown to bind image slider jquery,
Then Data are came Properly but
Image slider Stop Working,

This time Java script are:

<script type="text/javascript">

    function mycarousel_initCallback(carousel) {
        // Disable autoscrolling if the user clicks the prev or next button.
        carousel.buttonNext.bind(''click'', function () {
            carousel.startAuto(0);
        });

        carousel.buttonPrev.bind(''click'', function () {
            carousel.startAuto(0);
        });

        // Pause autoscrolling if the user moves with the cursor over the clip.
        carousel.clip.hover(function () {
            carousel.stopAuto();
        }, function () {
            carousel.startAuto();
        });
    };

    jQuery(document).ready(function () {
        jQuery(''#mycarousel'').jcarousel({
            auto: 2,
            wrap: ''last'',
            initCallback: mycarousel_initCallback
        });
    });
   
   
</script>









所以请帮助我,我能做什么,



如果您对问题有任何困惑,那么请注意,我会尝试改进它





So plz Help me, What Can i do,

If You have Any Confusion About Question, Then Plz Comment, I Will try to improve it

推荐答案

document.ready()不适用于异步回发。你必须重新绑定你的功能:

document.ready() does not work with async postback. You have to re-bind your functionality something like this:
jQuery(document).ready(function () {
jQuery('#mycarousel').jcarousel({
auto: 2,
wrap: 'last',
initCallback: mycarousel_initCallback
});
});

var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function() {
jQuery('#mycarousel').jcarousel({
auto: 2,
wrap: 'last',
initCallback: mycarousel_initCallback
});
});


我在google的帮助下找到解决方案:



i find the solution with the help of google:

<script type="text/javascript">


(function(){
Sys.WebForms.PageRequestManager.getInstance()。add_endRequest(EndRequestHandler);
});

函数EndRequestHandler(sender,args){
//您希望在请求完成时运行的代码
}
< script >
(function() { Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); }); function EndRequestHandler(sender, args) { // code that you want to run when the request is complete } <script>







在异步回发后回复工作




It Work Fine on async postback post back


这篇关于在下拉列表中再次调用java脚本选择索引更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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