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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:12:38+00:00 2026-05-17T06:12:38+00:00

My jQuery code hides a ddl under certain circumstances. When this is the case,

  • 0

My jQuery code hides a ddl under certain circumstances. When this is the case, after submitting the form, using the UpdateModel doesn’t seem to work consistently. My code in the controller:

// POST: /IllnessDetail/Edit
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Edit(IllnessDetail ill)
        {
            IllnessDetailFormViewModel mfv = new IllnessDetailFormViewModel(ill);
            if (ModelState.IsValid)
            {
                try
                {
                    IllnessDetail sick = idr.GetLatestIllnessDetailByUsername(User.Identity.Name);
                    UpdateModel(sick);
                    idr.Save();
                    return RedirectToAction("Current", "IllnessDetail");
                }
                catch
                {
                    ModelState.AddRuleViolations(mfv.IllnessDetail.GetRuleViolations());
                }
            }
            return View(new IllnessDetailFormViewModel(ill));
        }

I have only just started with MVC, and working under a deadline, so am still hazy as to how UpdateModel works. Debugging seems to reveal that the correct value is passed in to the action method:

public ActionResult Edit(IllnessDetail ill)

And the correct value is put into sick in the following line:

IllnessDetailFormViewModel mfv = new IllnessDetailFormViewModel(ill);

However, when all is said, done and returned to the client, what displays is the value of:

sick.IdInfectiousAgent

instead of the value of:

ill.IdInfectiousAgent

The only reason I can think of is that the ddlInfectiousAgent has been hidden by jQuery. Or am I barking up the wrong lamp post?

Andrew

  • 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-05-17T06:12:38+00:00Added an answer on May 17, 2026 at 6:12 am

    Just realised I hadn’t updated this. The cause of the whole issue was not related to jQuery at all, as an error was happening in the server code that was being “swallowed” by the AJAX response.

    I finally detected the error by opening the page in FireFox and using FireBug to see if any errors happened. This may seem obvious to some, but I was new to AJAX. But then I downloaded FireBug and saw that it was good…

    The jQuery was actually just (correctly) telling me that no results had been returned by the call. It didn’t cross my mind that this might be because an error had been returned instead.

    The error in question was that I was using an HttpGet in an app upgraded to MVC 2, so got snagged by the new JsonRequestBehavior parameter, as in:

    return Json(IllnessDetailRepository.CascadedInfectiousAgent(Id), 
                JsonRequestBehavior.AllowGet);
    

    This parameter didn’t exist in MVC 1, and I was unaware of its adition to MVC 2. RTFM, as they say.

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

Sidebar

Related Questions

My jQuery code hides a ddl under certain circumstances. When this is the case,
I'm using this jquery code to show and hide divs on my page. As
I'm using Firefox and JQuery: The following code hides the content briefly, but then
I have a simple peice of jQuery code that submits a form and hides/shows
I have this jquery code: <script type=text/javascript> jQuery(document).ready(function($){ // hides the slickbox as soon
Here is jquery code which hides my table cells with the ID of .style2:
I implemented this Jquery show/hide code and everything works fine except that the box
all I want to show hide some ids using jQuery. My html code is
I have some JQuery code that shows or hides a div. $(div#extraControls).show(); // OR
i'm using jquery toggle to show/hide a div on different links. It shows/hides them

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.