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

  • Home
  • SEARCH
  • 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 8057435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:01:51+00:00 2026-06-05T09:01:51+00:00

I have built a jquery dialog to show a partial view for entering data.

  • 0

I have built a jquery dialog to show a partial view for entering data.

I have built the action link:

    @Html.ActionLink("Add New Service Provider", "PartialNewCust", "Customer", null,    new { @class = "addServiceProviderLink" })

I have the controller action:

public ActionResult PartialNewCust()
        {
        return PartialView();
        }

And the div / jQuery code:

<div id="AddServiceProvDialog" title="Add Service Provider"></div>


<script type="text/javascript">
var linkObj;
$(function () {
    $(".addServiceProviderLink").button();

    $('#AddServiceProvDialog').dialog(
    {
        autoOpen: false,
        width: 400,
        resizable: false,
        modal: true,
        buttons:
        {
            "Add": function () {
                $("#addProviderForm").submit();
            },
            "Cancel": function () {
                $(this).dialog("close");
            }
        }
    });

    $(".addServiceProviderLink").click(function () {
        linkObj = $(this);
        var dialogDiv = $('#AddServiceProvDialog');
        var viewUrl = linkObj.attr('href');
        $.get(viewUrl, function (data) {
            dialogDiv.html(data);
            //validation
            var $form = $("#addProviderForm");
            // Unbind existing validation
            $form.unbind();
            $form.data("validator", null);
            // Check document for changes
            $.validator.unobtrusive.parse(document);
            // Re add validation with changes
            $form.validate($form.data("unobtrusiveValidation").options);
            //open dialog
            dialogDiv.dialog('open');
            return false;
        });

    });

});

The partial view renders fine but opens a new page and does not come up as a modal dialog.

What am I doing wrong.

On a side note: my autocomplete code is also not working by my jQuery datetime picker is…

$(document).ready(function() 
{
$(".date").datepicker();
}
);


$(document).ready(function () {
$("#CustByName").autocomplete(
    {
        source: function (request, response) {
            $.ajax(
            {
                url: "/Cases/FindByName", type: "GET", dataType: "json",
                data: { searchText: request.term, maxResults: 10 },
                contentType: "application/json; charset=utf-8",
                success: function (data) {
                    response($.map(data, function (item) {
                        return {
                            label: item.CustomerName,
                            value: item.CustomerName,
                            id: item.CustomerID
                        }
                    })
                    );
                }
            });
        },
        minLength: 3
    });

});
  • 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-05T09:01:54+00:00Added an answer on June 5, 2026 at 9:01 am

    My guess is that you misplaced the return false statement in the button’s click handler, thus the default behavior is not prevented as you expect, and the link is simply followed:

    $(".addServiceProviderLink").click(function () {
        ...
        $.get(viewUrl, function (data) {
            dialogDiv.html(data);
            ...
            dialogDiv.dialog('open');
    
            // this return statement should be in the "click" handler,
            // not in success callback of the .get() method !
            return false;
        });
    
    });
    

    Your code should then be:

    $(".addServiceProviderLink").click(function () {
        ...
        $.get(viewUrl, function (data) {
            ...
        });
    
        // return here to prevent default click behavior
        return false;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new using Jquery. I am using vb.net 2008, and I have built
So I have built a custom dialog JQuery Plugin, but am having issues with
I have a div tag in my modal dialog built using JQuery like this:
i have a modal popup built with jquery UI ($.dialog) that contains an iframe
I have built a function using jQuery to insert into a table a new
I have built a simple menu in jQuery http://vanquish.websitewelcome.com/~toberua/ Here is a sample of
I have built a mobile app using Rhomobile, jQuery Mobile and Google Maps API.
I am using jQuery cycle in combination with a mousewheel plugin. I have built
I have a slideshow built in flash that I want to mimic in jQuery.
I have built a webpage, splashcreen.html , that when someone loads index.php will automatically

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.