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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:01:08+00:00 2026-06-01T14:01:08+00:00

I am using MVC3 and Entity Framework. I have a List on a page

  • 0

I am using MVC3 and Entity Framework. I have a List on a page with checkboxes for the user to select multiple items. (The goal is to “Reassign” multiples at a time).

When the user clicks the “Reassign” buttion it invokes a JQuery Dialog box to appear and it loads the partial view. On the partial view, I have a hidden field for the checkboxes that were selected.

An example would be:

<input type="hidden" value="2,4,5" class="tasks" name="tasks" />

However, my code runs too fast for the JQuery to grab which checkboxes were checked. When I view the Dialog box HTML in Firebug, the value is empty.

I have tested my code out by doing:

    var checkeditems = $('input:checkbox[name="selectedObjects"]:checked').map(function () { return $(this).val() }).get().join(",");
    alert(checkeditems);
    $('input.tasks').val(checkeditems);

Weirdly, the values are put into the hidden field. Without the alert, they are not there.

Here is my Javascript:

$('#ReAssign').bind('click', function (event, ui) {
    GetReassign();
    return false;
});

function GetReassign() {
    $("#ReassignDialog").dialog({
        height: 315,
        width: 525,
        modal: true,
        draggable: false,
        resizable: false,
        open: function (event, ui) {
            $(this).load('/InterviewFollowup/ReassignPartial');
        },
        buttons: {
            Ok: function () {
                $(this).dialog("close");
            }
        }
    });

    var checkeditems = $('input:checkbox[name="selectedObjects"]:checked').map(function () { return $(this).val() }).get().join(",");
    $('input.tasks').val(checkeditems);
}

Here is my View:

@using (Html.BeginForm("ReassignPost","InterviewFollowup")) {
<fieldset>
    <legend><strong>Re-Assign Task</strong></legend>

    <input type="hidden" value="" id="tasks" class="tasks" name="tasks" />

    <div class="editor-label">
        Location:
    </div>
    <div class="editor-field">
        @Html.DropDownList("MailCodes", (SelectList)ViewBag.MailCodes,"-- Select --")
        @Html.ValidationMessage("MailCodes") 
    </div>

    <br />

    <div class="editor-label">
        @Html.LabelFor(model => model.AssignedTo)
    </div>
    <div class="editor-field">
        <select name="AssignedTo" id="AssignedTo"></select>
    </div>

    <div class="editor-label">
        Notes:
    </div>
    <div class="editor-field">
        <input type="text" name="Notes" id="Notes" />
        @Html.ValidationMessage("Notes") 
    </div>

    <p>
        <input type="submit" value="Submit" />
        <input type="button" value="Cancel" />
    </p>

</fieldset>
}
  • 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-01T14:01:09+00:00Added an answer on June 1, 2026 at 2:01 pm

    The .load() jQuery function is asynchronous (it’s an AJAX call), so this code:

    var checkeditems = $('input:checkbox[name="selectedObjects"]:checked').map(function () { return $(this).val() }).get().join(",");
    $('input.tasks').val(checkeditems);
    

    is run before the partial view has been loaded, and therefore your $('input.tasks') selector doesn’t match an element – adding the alert fixes this because it delays execution of the next line until after the AJAX call has completed. You’ll want to move that code into a callback function for when the .load() has completed, like so:

    $(this).load('/InterviewFollowup/ReassignPartial', function() {
        var checkeditems = $('input:checkbox[name="selectedObjects"]:checked').map(function () { return $(this).val() }).get().join(",");
        $('input.tasks').val(checkeditems);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Entity Framework 4, MVC3, C# I have created a complex type within the
I have a C#-4 MVC3 RC test-application which is using Entity Framework 4. I
I am building a movie site. I am using mvc3 and entity framework. I
My scenario I'm using Visual Studio 2010 with Entity Framework 4.1 I have a
I'm setting up a blog using Asp.net MVC3 and Entity framework 4. Most of
We have a simple intranet site in MVC3 and entity framework. Everything works fine
I'm using ASP.Net MVC3, and Entity Framework 4. Employee has an OfficeLocation, which is
I'm writing an ASP.net MVC3 application using Entity Framework Code First and SqlCe4. I
I am trying to setup editing functionality using MVC3 and entity framework 4. I
I'm currently developing an app using ASP.NET MVC3 and Entity Framework 4.1 Code First

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.