How to trigger a postback using JQuery Droppable plugin ?

Posted by Sandeep K Ram on Stack Overflow See other posts from Stack Overflow or by Sandeep K Ram
Published on 2010-05-11T12:22:05Z Indexed on 2010/05/11 12:34 UTC
Read the original article Hit count: 266

Hi,

This is my script for the draggable and droppable

<script type="text/javascript">

    $(function() {

        $(".Source li").draggable({
            appendTo: "body",
            helper: "clone",
            revert: "invalid"
        });
        $(".Destination ").droppable({
            activeClass: "ui-state-default",
            hoverClass: "ui-state-hover",
            accept: ".Source li",

            drop: function(event, ui) {
                $(this).find(".placeholder").remove();
                $("#Hf1").val(ui.draggable.text());
                $("#TxtItemId").val($("#Hf1").val());



           }
        });

    });

</script>

Now I want to access the value of the "TxtItemId" control in the code-behind through a postback. How do I go about doing this ?

BTW, this is for a scenario where a person will drag an item from a panel into a shopping cart and I need to capture the Id of the dropped item and trigger a postback after the drop to update the quantity of that item in the cart.

© Stack Overflow or respective owner

Related posts about drag-and-drop

Related posts about ASP.NET