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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:08:30+00:00 2026-06-16T03:08:30+00:00

Here is my ViewModel class which i am binding with a radio button and

  • 0

Here is my ViewModel class which i am binding with a radio button and check box

public class MyListViewModel
{
    public bool Isselected { get; set; }
    public Int32 ID { get; set; }      
    public string EmpName { get; set; }
    
}

Issue: For check box in a controller class i can able to see IsSelected property with the binded model is true if select. But in case of Radio button it always shows false. Any help appreciated

Check Box

Razor code

 @Html.CheckBox(myListObj.Isselected.ToString(), myListObj.Isselected, 
  new { id = myListObj.Isselected.ToString() })

Produced HTML

 <input type="checkbox" value="true" name="myListObj[0].Isselected" id="22">
 <input type="hidden" value="false" name="myListObj[0].Isselected">

Radio Button

Razor:

 @Html.RadioButton(myListObj.Isselected.ToString(), myListObj.ID, 
 myListObj.Isselected, new { id = myListObj.Isselected.ToString() }) 

Html:

<input type="radio" value="6"
 name="myListObj[0].Isselected" id="myListObj[0].Isselected">

What could be the problem here?

Edited: 
What could be the code for binding a model with multiselect radio button. 
I mean user can select more than one Employee from a list. 
I want to know what are the employees selected with the help of Model Binding 
class with the property IsSelected. Please suggest me the possible way.
  • 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-06-16T03:08:32+00:00Added an answer on June 16, 2026 at 3:08 am

    The value property of the radio button is what gets sent to the server, so in this case, the value 6 is being sent but the server can’t stick 6 into Isselected b/c Isselected is of type boolean.

    You need to change the html to this

    @Html.RadioButton(myListObj.Isselected.ToString(), true, myListObj.Isselected, new { id = myListObj.Isselected.ToString() })
    

    Note how I changed myListObj.ID to just true. This says to the browser “if the user selects this radio button, send the value true to the server”.

    Alternatively, you could change Isselected to a double? and continue using the ID value. This way, if the radio button is not selected, the server will see null; if it is selected, the server will see 6.

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

Sidebar

Related Questions

What am I missing here? ViewModel: public class ViewModel { public IDictionary<int, string> Entities
Here's the view: @if (stream.StreamSourceId == 1) { <img class=source src=@Url.Content(~/Public/assets/images/own3dlogo.png) alt= /> }
I've a ViewModel class like this in a Prism / WPF project. public class
Consider the following ViewModel property: private string _slowProperty; public string SlowProperty { get {
I have a ViewModel class which i want to respond to the built in
I’ve got a property in a base class (view model), which when used in
I have two separate binding problems with listboxes with an itemtemplate which contains a
I have a listbox to which I'm binding HistoryItems , where HistoryItems is a
I want to create some extended Binding-Markup-Extension, which behaves just like a normal WPF-Binding
I have a viewmodel which implement INotifyPropertyChanged . On this viewModel is a property

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.