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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:01:48+00:00 2026-05-14T03:01:48+00:00

I have following view <asp:Content ID=Content2 ContentPlaceHolderID=MainContent runat=server> <h2>Tables <%=ViewData[RetriverName] %></h2> <%using (Html.BeginForm(ResfreshSelectedTables, Home))

  • 0

I have following view

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
   <h2>Tables <%=ViewData["RetriverName"] %></h2>
   <%using (Html.BeginForm("ResfreshSelectedTables", "Home"))
     { // begin form%>
   <table id="MyTable">
      <thread>
      <tr>
      <th style="width: 150px; text-align:center"><input type="checkbox" id="SelectAll" />Select All..</th>
      </tr>
         <tr>
            <th style="width:20px; text-align:right">ID</th>
            <th style="width:40px">Base Table</th>
            <th style="width:50px">Table</th>
            <th style="width:280px">Description</th>
         </tr>           
     </thread>
      <tbody>
         <%  int i = 0;
             foreach (var item in Model)
             { %>
         <tr id="row<%= i.ToString() %>">
            <td align="center" style="padding: 0 0 0 0"> 
                            <%= Html.CheckBox("selections[" + i.ToString() + "].IsSelected", item.IsSelected)%> 
                            <%= Html.Hidden("selections[" + i.ToString() + "].ID", item.id)%> 
                           <%= Html.Hidden("selections[" + i.ToString() + "].BaseTable", item.baseTable)%> 
                            <%= Html.Hidden("selections[" + i.ToString() + "].Name", item.NAME)%> 
                        </td> 

            <td style="text-align:right"><%=Html.Encode(item.id)%></td>
            <td><%= Html.Encode(item.baseTable)%></td>
            <td><%=Html.Encode(item.NAME)%></td>
            <td><%=Html.Encode(item.Description) %></td>
         </tr>
         <% i++;
             } %>
      </tbody>
   </table>
   <p>
   <input type="submit" value="saving"  />
   </p>
   <% }//end form %>
   <script src="../../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> 

    <script type="text/javascript">
       // Select All Checkboxes
       $(document).ready(function() {
          $('#SelectAll').click(function() {

             var newValue = this.checked;
             $('input:checkbox').not('input:hidden').each(function() {
               // alert(this.id+newValue );
                this.checked = newValue;
             });
          });
       }); 
    </script> 

</asp:Content>

How do I postback selected checkboxes to the controller ?

  • 1 1 Answer
  • 1 View
  • 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-14T03:01:49+00:00Added an answer on May 14, 2026 at 3:01 am

    Try adding a hidden field for the index of the selected item, as shown in one of Phil Haack’s blog posts. You’d then receive the collection as a list of that type on the controller. This will ensure that the collection gets items with both the checked and unchecked checkboxes, in the correct order on the server side. Filter the list to choose only those with IsSelected having value true.

       <%= Html.Hidden("selections.Index", i) %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Take following example of code: (ASP.NET WebForms) <asp:Content ContentPlaceHolderID=Contents runat=server> <div class=blogpost-list> <asp:Repeater ID=blogList
I have the following view definition in my asp.net mvc website: <% Using Ajax.BeginForm(UsrCtlChangePassword,
i have the following code in an asp.net mvc view. <% = Html.DropDownList(Filter, new
I have a CheckBox on an ASP.NET Content Form like so: <asp:CheckBox runat=server ID=chkTest
I have an ASP MVC view where have the following statement #if DEBUG //section
I am using ASP.NET MVC with jQuery. I have the following MVC Action that
I'm using Razor in MVC 3 and Asp.net C#. I have a View with
I've built an asp website and i have the following issues:- i'm using a
I have the following view in ASP.net MVC 3: @model Models.CreateProjectViewModel <script type=text/javascript src=@Url.Content(~/Scripts/jquery.validate.min.js)></script>
i have the following Ajax.beginform inside my asp.net mvc view, where the result of

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.