Question

i am trying to get asmSelect, which works fine on its own:

http://www.ryancramer.com/projects/asmselect/examples/example1.html

but i am now trying to get it to work on a page that get dynamically populated into a jquery UI dialog popup but it doesn't seem to be working. I am basically mimicing the code below and rendering a partialresult inside of a dialog.

http://blog.stevehorn.cc/2009/06/rendering-modal-dialog-with-aspnet-mvc.html

i guess my question is when you are loading stuff dynamically through ajax, this code in asmSelect doesn't seem to work as the code isn't there yet.

<script type="text/javascript">
    $(document).ready(function() {
        $("select[multiple]").asmSelect();
    });
 </script>

where can i put this ? do i need to shove all of the jquery references and this code into the usercontrol?

Was it helpful?

Solution

Since your code copies this tutorial, you would want to add your .asmSelect() call after the $('#container').append(htmlResult); call like this (Just the get sample shown here):

$.get(
    "Home/RandomPopupView",
    function( htmlResult ){
        $('#RandomModal').remove();
        $('#container').append( htmlResult );
        $("#container select[multiple]").asmSelect();
        $('#RandomModal').dialog();
    });
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top