Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8494087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:12:13+00:00 2026-06-10T23:12:13+00:00

I am using asp.net mvc3 and jqueryUI. here’s my code for drag and drop,

  • 0

I am using asp.net mvc3 and jqueryUI. here’s my code for drag and drop, it works, I have no problem to drag and drop.

<script type="text/javascript">
    $(function () {
        $(".sourceItem").draggable({
            helper: "clone",
            appendTo: "body"
        });

        $("#targetBox").droppable({
            accept: ".sourceItem",
            hoverClass: "drop-active",
            drop: function (event, ui) {
                $("#targetBox").append("test");                   
            }
        });
    }); 
</script>

after you drop the content to “targetBox”, now, if you click on the “btnBlend” button, “smoothieBox” Div will be updated.

    <div id="smoothieBox">
        @using (Ajax.BeginForm("Summary", "Home", new AjaxOptions { UpdateTargetId = "smoothieBox" }))
        {
            @Html.ValidationSummary(true)
            @Html.AntiForgeryToken()
            <div id="blender">
                <div id="targetBox" class="clearfix">
                </div>
                <input id="btnBlend"  type="image" src="@Links.Content.images.btn_blend_png" name="image" width="137" height="33" />
            </div>           
        }
    </div>

The new Content in the “smoothieBox” Div will be:

@using (Ajax.BeginForm("Blender", "Home", new AjaxOptions { UpdateTargetId = "smoothieBox" }))
{
    @Html.ValidationSummary(true)
    @Html.AntiForgeryToken()

    @Html.HiddenFor(x =>x.SmoothieId )

    <input id="btnGoBack"  type="image" src="@Links.Content.images.btn_go_back" name="image" width="137" height="33" />            
}

now, if you click on “btnGoBack” button, “smoothieBox” Div will be updated again to show the original content, you should be able to drag and drop again. however, this time I cannot drop it. I coudln’t figure out why, probably because the target div “targetBox” is removed , then add it back using ajax. I probably have to re-enable the drop, but not really sure how to do it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:12:15+00:00Added an answer on June 10, 2026 at 11:12 pm

    I guess when the ajax occurred then this event get unbind to that DOM element. So you must have to rebind these events.

    Add an ajax option “OnSuccess” in the form. This method wil call after the ajax request success.

    @using (Ajax.BeginForm("Blender", "Home", new AjaxOptions 
                                      { 
                                         UpdateTargetId = "smoothieBox",
                                         OnSuccess = "OnSuccess"
                                      }))
    

    In the script :

    <script type="text/javascript">
      $(function () {
         BindEvents();
      });
    
      function OnSuccess() {
         BindEvents();
      }
    
      function BindEvents(){
         $(".sourceItem").unbind("draggable").draggable({
            helper: "clone",
            appendTo: "body"
         });
    
         $("#targetBox").unbind("droppable").droppable({
            accept: ".sourceItem",
            hoverClass: "drop-active",
            drop: function (event, ui) {
                $("#targetBox").append("test");                   
            }
         }); 
      } 
    
    </script>
    

    Hope this will help !!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using ASP.NET MVC3 with EF Code First. I have not worked previously
I'm developing a dashboard using ASP.NET MVC3 and need to have two divs which
I am creating an ASP.NET MVC3 application using NHIBERNATE. I have a base class
I am using Razor syntax in an ASP.NET MVC3 View inside a JavaScript code
I had created a webpage using asp.net mvc3 razor. I have two master pages
I have a string created using asp.net MVC3 Razor block like this: @{ var
Using: ASP.NET MVC3 Ninject 2 Fluent nHibernate I have 2 databases (DB1 & DB2).
Here is the the thing. I'm using ASP.NET MVC3 to build an app and
I develop in ASP.NET MVC3, I have the code below to send the view
I am using asp.net Mvc3 I have 2 controllers in two different projects. HomeController

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.