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

The Archive Base Latest Questions

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

Ok, I’m an MVC newbie coming from a webforms background, so please excuse any

  • 0

Ok, I’m an MVC newbie coming from a webforms background, so please excuse any ignorance here. Here is my scenario. I’ve got a table consisting of a list of applications and associated permissions. Each table row consists of 3 pieces of information: a checkbox, some text describing the row, and a dropdown list allowing the user to select the appropriate permission for the application. I want to post this data and only work with the rows in the table which were checked (the id of the row is embedded as the checkbox name). From there, I want to grab the selected value from the DropDownList, and call the necessary code to update the DB. Here is my View page’s code:

            <%foreach (var app in newApps)               { %>                 <tr>                     <td><input type='checkbox' name='AddApps' value='<%=app.ApplicationId %>' /></td>                     <td><%=Html.Encode(app.ApplicationName)%></td>                     <td><%=Html.DropDownList('AppRole', new SelectList(app.Roles, 'RoleId', 'RoleDescription'))%></td>                 </tr>               <%} %> 

How would I retrieve the appropriate values from the FormCollection when I get to the controller on form post? I have done this in the past when I only had checkbox values to retrieve by just calling Request.Form[‘CheckBoxName’] and parsing the string.

Or am I going about this entirely wrong?

  • 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. 2026-05-11T01:22:26+00:00Added an answer on May 11, 2026 at 1:22 am

    You are halfway right in order to post your data that the controller can read the info it must be inside a form as so :

           <% using(Html.BeginForm('Retrieve', 'Home')) %>//Retrieve is the name of the action while Home is the name of the controller        <% { %>             <%foreach (var app in newApps)              { %>             <tr>                 <td><%=Html.CheckBox(''+app.ApplicationId )%></td>                 <td><%=Html.Encode(app.ApplicationName)%></td>                 <td><%=Html.DropDownList('AppRole', new SelectList(app.Roles, 'RoleId', 'RoleDescription'))%></td>             </tr>           <%} %>        <input type'submit'/>      <% } %> 

    and on your controller :

          public ActionResult Retrieve()     {         //since all variables are dynamically bound you must load your DB into strings in a for loop as so:       List<app>=newApps;       for(int i=0; i<app.Count;i++)       {           var checkobx=Request.Form[''+app[i].ApplicationId];         // the reason you check for false because the Html checkbox helper does some kind of freaky thing for value true: it makes the string read 'true, false'           if(checkbox!='false')           {           //etc...almost same for other parameters you want that are in thr form           }         }     //of course return your view     return View('Index');//this vaires by the name of your view ex: if Index.aspx    } 

    This site gives more details on how to handle the dropdownlist helper:

    http://quickstarts.asp.net/previews/mvc/mvc_HowToRenderFormUsingHtmlHelpers.htm

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

Sidebar

Ask A Question

Stats

  • Questions 58k
  • Answers 58k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer I decided to write my own ReadLine parser-ish kinda thing.… May 11, 2026 at 8:49 am
  • added an answer Try giving the full path to apache2ctl. May 11, 2026 at 8:49 am
  • added an answer I purchased Microsoft Visual Studio 2005 Professional Edition (C5E-00001). Included… May 11, 2026 at 8:49 am

Top Members

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

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.