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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:35:54+00:00 2026-06-12T14:35:54+00:00

I m trying to get a list of radiobuttons from the controller and display

  • 0

I m trying to get a list of radiobuttons from the controller and display it on the View but it dosent seem to be working. I have the following model

public class Module
{

    public int ModuleId { get; set; }

    public string Title { get; set; }

    public string Description { get; set; }

    public bool IsActive { get; set; }

}

In the controller I am getting the list of modules and passing it to the view:

[HttpGet]
    public ActionResult SelectAdmin()
    {
        //getting the list of modules from db
        List<Module> modulelst = GetModules(); 
        ViewBag.lstm = modulelst;

        return PartialView();
    }

Now in the View I’m trying to display the list of modules in the form of RadioButtons/Checkboxes and getting the corresponding id for the module which is selected.

The code for the View I am trying is as follows:

@model List<MyFriday.Domain.Model.Client>

@using (Ajax.BeginForm(“SelectAdmin”, “CMAdmin”, null,
new AjaxOptions
{
UpdateTargetId = “update-message”,
InsertionMode = InsertionMode.Replace,
HttpMethod = “POST”,
OnSuccess = “UpdateSuccess”
}, new { @id = “EditForm” }))
{
@Html.ValidationSummary(true)

<fieldset>

<div class="content">                     
            @using (Html.BeginForm())
            {
                <div>
                Select the Admin Type:
                 </div>
                <div id="divModules">
                @foreach (var Modules in ViewBag.lstm)
                {
                    <div class="formlabel">
                        <div align="right" class="label" style="cursor: pointer; position: relative;">
                            @(Modules.First().Title)
                        </div>
                    </div>
                    <div class="formelement">
                        <input type="radio" id=""/>
                            @(Modules.First().ModuleId)

                    </div>
                    <div style="clear: both;">
                    </div>
                }
                </div>
                <input id="Submit1"  type="submit" value="Submit"/>
                <input type="button" value="Cancel" onclick="javascript:cancelconfirm(this)"/>   

            }
            <div style="clear: both;">
                &nbsp;</div>

        </div>

</fieldset> 

}

The Above View is not getting displayed

Can anyone please suggest me a solution ?

  • 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-12T14:35:56+00:00Added an answer on June 12, 2026 at 2:35 pm

    First I would change the controller:

    [HttpGet]
    public ActionResult SelectAdmin()
    {
        //getting the list of modules from db
        List<Module> modulelst = GetModules(); 
        // ViewBag.lstm = modulelst;
    
        return PartialView(modulelst);
    }
    

    Then change the View… add the decalration it uses the model on the first line:

    @model List<Module>
    

    and then change the for loop to:

                @foreach (var module in Model)
                {
                    <div class="formlabel">
                        <div align="right" class="label" style="cursor: pointer; position: relative;">
                            @Html.DisplayFor(modelItem => module.Title, true)
    
                        </div>
                    </div>
                    <div class="formelement">
                        <input type="radio" id=""/>
                            @RadioButtonFor(modelItem => module.ModuleId, new { @id="ModuleId"})
    
                    </div>
                    <div style="clear: both;">
                    </div>
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to get simple YES/NO radio buttons list working but facing
Trying to get a list of all substrings currently I have a function but
I am trying to get list of numbers from: numbers= 1,2 to: '1','2' I
I am trying to get a list of Files in a Folder from Google
I am trying to get a list of hrefs from a list of ten
in C#, i'm trying to get some properties from the instances of Win32_Product, but
Im trying to get a list of posts from WordPress for the last 7,30
Hi guys I have a strange issue. I am trying to get list of
I am trying to get a list of distinct values from the columns out
I am trying to get list of recent posts from a blog filtered by

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.