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 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 83k
  • Answers 83k
  • 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
  • Editorial Team
    Editorial Team added an answer You could try the classic MySQL world database. The world.sql… May 11, 2026 at 4:54 pm
  • Editorial Team
    Editorial Team added an answer declare @xml xml set @xml = '<my:myFields xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-03-16T20:13:11"> <my:field>test1</my:field> <my:field>test2</my:field>… May 11, 2026 at 4:54 pm
  • Editorial Team
    Editorial Team added an answer I do not think you can test this code using… May 11, 2026 at 4:54 pm

Related Questions

OK, I know what you're thinking, "why write a method you do not want
Ok, I asked a question earlier about Flex and ADO.NET Data Services but didn't
Ok, I have been working with Solaris for a 10+ years, and have never
OK, I know there have already been questions about getting started with TDD ..
Ok, I have a strange exception thrown from my code that's been bothering me

Trending Tags

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

Top Members

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.