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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:53:22+00:00 2026-05-25T01:53:22+00:00

My question isn’t so much about displaying the data its about collecting changes to

  • 0

My question isn’t so much about displaying the data its about collecting changes to the data.

My specific scenario is the need to allow users to delete multiple items from a list. I don’t know if i’m even approaching this in a locgical way.

The List is a collection of Private Messages. My view model has strings for To, From, Subject, and a bool for “Delete”.

public class PrivateMessagesModel {

    public PrivateMessagesModel()
    {
        PrivateMessages = new List<PrivateMessageReceivedModel>();
    }

    public List<PrivateMessageReceivedModel> PrivateMessages;
}

public class PrivateMessageReceivedModel
{

    [DataType(DataType.Text)]
    [Display(Name = "From")]
    public string From { get; set; }

    [DataType(DataType.Text)]
    [Display(Name = "Subject")]
    public string Subject { get; set; }

    [DataType(DataType.Text)]
    [Display(Name = "Message")]
    public string Message { get; set; }

    [DataType(DataType.Text)]
    [Display(Name = "Date")]
    public DateTime DateTimeSent { get; set; }

    [DataType(DataType.Text)]
    [Display(Name = "Delete")]
    public bool Delete { get; set; }

}

The code to display looks like this. And works ok.

@

model ScaleRailsOnline.Models.PrivateMessagesModel 
@{
    ViewBag.Title = "Private Messages";
}
<div id="content">
    <div class="content">
        <h2>
            Private Messages</h2>
        @using (Html.BeginForm())
        { <table>
            @for (int i = 0; i < Model.PrivateMessages.Count; i++)
            {
                <tr>
                    <td>
                        @Html.CheckBoxFor(m => m.PrivateMessages[i].Delete)
                    </td>
                    <td>
                        @Html.DisplayTextFor(m => m.PrivateMessages[i].From)
                    </td>
                </tr>
            }
        </table>
            <p>
                <input type="submit" value="Delete" />
            </p>
        }
    </div>
</div>

The problem is when I check a couple of the check boxes and hit the delete button, i get nothing back in the model.

Again, im sure i’m not approaching this in the right way. Any help would be appreciated.

  • 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-25T01:53:23+00:00Added an answer on May 25, 2026 at 1:53 am

    You need to have a controller associated to the Html.BeginForm where the form will be posted.
    eg

     <div id="formid">
        @using (Html.BeginForm("Index1", "Home", new AjaxOptions { UpdateTargetId = "formid",OnSuccess ="OnSuccess" }, new { id = "TheForm" }))
        {  
          @for (int i = 0; i < Model.PrivateMessages.Count; i++)
          {
              @Html.CheckBoxFor(m => m.PrivateMessages[i].Delete)
          }
          <input type="submit" name="name" value="Submit" />
        }
      </div>
    

    On Controller

    public ActionResult Index1(List<PrivateMessageReceivedModel> mod)
     {
       //Now in the mod you will get the value of the delete checkbox.
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My question isn't so much programming specific, I guess, but more interface-specific. My problem
So, iCloud is still under NDA, but my question isn't so much about iCloud
This question isn't so much a 'how to solve' question as its a question
This question isn't about unit-testing. And it is for a desktop product. This is
Important: This question isn't actually really an ASP.NET question. Anyone who knows anything about
So this question isn't about integrating an existing payment gateway into my site. This
I apologise in advance if this question isn't very specific. Would it be possible
This question isn't really for any specific technology but more of general developer question.
This question isn't about popping up an iframe inside a Lightbox; rather, it's about
First of all, my question isn't really specific to C# or XNA, but my

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.