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

The Archive Base Latest Questions

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

I have the following code: @using (Html.BeginForm()) { for (int i = 0; i

  • 0

I have the following code:

            @using (Html.BeginForm())
                {
                    for (int i = 0; i < Model.Themes.Count; i++)
                    {

                    <div class="theme">
                        <img src="/Content/img/placeholder/@Model.Themes[i].PreviewImg" class="theme-image" />
                        <div class="theme-meta">
                            @Html.RadioButton("Themes", Model.Themes[i].Selected, new { @id = "Themes_" + i + "__Selected" })

                            @Html.TextBoxFor(x=>x.Themes[i].Id)
                            <label>@Model.Themes[i].Name</label>
                        </div>
                    </div>
                    }
                    <div class="submit">
                        <input type="submit" class="dash-module-alt-button submit" name="SelectTheme" />
                    </div>
                }

However submitting this with one of the radio buttons selected does not bind with the selected property set to true.

Using Html.RadioButtonFor means that they all have a generated array name so they can all be selected.

HOW the eff am i supposed to do this?

cheers

w://

  • 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-25T21:22:39+00:00Added an answer on May 25, 2026 at 9:22 pm

    Not sure if this is what you want but Html.RadioButtonFor will take a value argument –

    @Html.RadioButtonFor(x => x.Themes, "blue")
    @Html.RadioButtonFor(x => x.Themes, "green")
    

    A method for using this in a loop is discussed in this question – When using .net MVC RadioButtonFor(), how do you group so only one selection can be made?

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

Sidebar

Related Questions

I have the following code: <% using (Html.BeginForm(AddComment, Comments, FormMethod.Post)) { %> <div id=New_Comment>
I have following code @using (Html.BeginForm()) { @Html.DropDownListFor(m => m.IDs, new SelectList(Model. IDs), Model.SelectedID)
Say I have the following code in my html: <html> <....> <img src=the-image.gif />
I have the following code in a MVC view: <% using (Html.BeginForm()) { %>
I'm using jQuery with rails and have the following piece of code $('#related').html(<%= render
I have the following code: using System; using System.Linq; using System.Linq.Expressions; public class Program
I have the following code: #include <iostream> #include boost/shared_ptr.hpp using boost::shared_ptr; class Base {
I have the following code in my view: <% using (Ajax.BeginForm(JsonCreate, new AjaxOptions {
I have the following code in a MVC 3 (Razor) project: <div class=user_info id=id_user_info>
i have following HTML code:- <table class=results> <tr> <td> <a href=..>link</a><span>2nd Mar 2011</span><br>XYZ Consultancy

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.