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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:41:21+00:00 2026-05-11T15:41:21+00:00

I have a number of dynamically created fields on the views. Lets say Car

  • 0

I have a number of dynamically created fields on the views. Lets say

Car Payment [1] [2] [3] House Payment [1] [2] [3] CC Payment [1] [2] [3] 

In my controller I want to see what values the user has selected for each one but I find that using the FormCollection I only get back ‘Car Payment’, ‘House Payment’, and ‘CC Payment’. I do not get back the actual values associated with those radiobutton selections unless I explicitly define those inputs as a controller variable. Unfortunately these radio buttons are dynamically generated, including their names so this isn’t an option. Any ideas in terms of handling this problem?

  • 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. 2026-05-11T15:41:22+00:00Added an answer on May 11, 2026 at 3:41 pm

    I think you really ought to be using the ValueProvider on the controller rather than referencing the parameters in the request itself. Using the value provider will make it much easier to unit test since you won’t have to mock up the request, just provide a ValueProvider implementation to the controller.

      ...   var provider = new FormCollection();   provider['CarPayment'] = '1';    var controller = new PaymentController();   controller.ValueProvider = provider.ToValueProvider();    var result = controller.Create();   ...     public ActionResult Create()   {       int carPaymentType = (int)this.ValueProvider['CarPayment'].ConvertTo(typeof(int));       ...   } 

    Obviously, you’ll need to add error checking, etc. You can also iterate through the keys on the ValueProvider just like you would on Request.Form.

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

Sidebar

Related Questions

I have a number of text-boxes which are created dynamically: <?php $columns = $_POST['n_cols'];
I have a form with dynamically created input fields - upon submitting it I
I have a series of fields created dynamically based on database records. They will
For my webpage, I have a number of lists which I'm generating dynamically from
I have a number of tables that use the Postgres Partitioning feature. I want
The background... Lets say I have a class called cars. We are just going
I have setup Knockoutjs to dynamically create an editable list of values using the
I have a situation where I have a number of objects that are dynamically
I have a form that I created with rows of input fields that are
I have a dynamically created jqGrid with a custom formatter. I need to be

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.