Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET Javascript
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" />
 

 

 
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
Posted 6-Jan-13 20:50pm
Edited 7-Jan-13 3:38am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
});
});
  Permalink  
Comments
Arun1990 at 8-Jan-13 0:15am
   
Thanks for Trying But It not work for me
Arun1990 at 8-Jan-13 0:44am
   
i find the solution,in google,
But Thanks,
because i properly understand my problem with the help of you
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

i find the solution with the help of google:
 
<script type="text/javascript">
    $(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
  Permalink  
v2
Comments
Zafar Sultan at 8-Jan-13 3:22am
   
That's exactly the same solution. Good you solved it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 7,215
1 DamithSL 5,114
2 Maciej Los 4,866
3 Sergey Alexandrovich Kryukov 4,747
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 8 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100