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 9241377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:21:43+00:00 2026-06-18T08:21:43+00:00

What I am trying to do is to open up a jquery dialog. What

  • 0

What I am trying to do is to open up a jquery dialog.
What is happening is that I see the following html text vs the rendering of the form when it tries to open up the PartialView:

     <form action="/Plt/FileUpload" method="post"><input data-val="true" data-val-number="The field PlNum must be a number." data-val-required="The PlNum field is required." id="PlNum" name="PlNum" type="hidden" value="36028" />     <div id="errMsg" >

     </div>
     <p>File upload for Pl# 36028</p>
     <input type="file" name="file" />
     <input type="submit" value="OK" />
     </form>

Here is the controller action:

       public ActionResult FileUpload(int id)
       {
         var model = new FileUpload { PlNum = id };
         return PartialView(model);
       }

This is what the view looks like for the PartialView:

    @model Ph.Domain.Lb.Models.FileUpload

    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    @using (Html.BeginForm("FileUpload", "Plts", FormMethod.Post, null))
    {

      @Html.HiddenFor(a => a.PlNum)

     <div id="errMsg" >
     @if (TempData["ErrMessage"] != null)
     {
       @TempData["ErrMessage"]
     }
     </div>

    <p>File upload for Pl# @Model.PlNum</p>
    <input type="file" name="file" />
    <input type="submit" value="OK" />
   }

This is what my ajax call looks like:

      var url = '@Url.Action("FileUpload", "Plt")' + '?id=' +  encodeURIComponent(rowid);

                 $.ajax({
                           url: url,
                           type: 'GET',
                           success: function(result) {                                    

                if (result.success) {
                  $('#dialog').dialog('close');
                } else {

             // refresh the dialog
                $('#dialog').html(result);
             }
         }  

To recap, the ajax call does reach the ActionResult but not sure when it tries to show the partial view it shows HTML vs the rendered html.

  • 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-18T08:21:44+00:00Added an answer on June 18, 2026 at 8:21 am

    The issue here is that you are trying to load razor view which has not been rendered into the dialog’s innerHTML. Instead what you should be doing is setting href property of the dialog to the URL.Action link, when creating the dialog. See the link below for an example.

    http://www.matthidinger.com/archive/2011/02/22/Progressive-enhancement-tutorial-with-ASP-NET-MVC-3-and-jQuery.aspx

    The other option, which is not very maintainable IMO, but which will work with way you are currently doing, is to return the raw HTML from the action method.

    I think the first solution is better because the controller is not polluted with HTML string concatenation.

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

Sidebar

Related Questions

I am trying to post data from my form to a jquery dialog that
I am trying to open a modal jquery dialog using jquery 1.4 and jquery-ui-1.8rc3.custom.js
I'm trying to do a confirm dialog using jquery, but the form doesn't get
I'm trying to get a jQuery dialog to close open clicking cancel, and open
I am currently trying to hook up jQuery UI dialog so that I may
I'm trying to open a Jquery UI dialog box after the user clicks on
I'm trying to open a jquery modal dialog box when the user clicks on
I am trying to create a JQuery dialog that resizes with the window, I
I'm having 2 issues with a JQuery dialog widget that I'm trying to solve.
I'm trying to open a jQuery dialog using AJAX. The content of the dialog

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.