Part 37 Generating a radiobuttonlist control in mvc using HTML helpers













YOUR LINK HERE:


http://youtube.com/watch?v=04RY04uKq2s



Text version of the video • http://csharp-video-tutorials.blogspo... • Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help. •    / @aarvikitchen5572   • Slides • http://csharp-video-tutorials.blogspo... • All ASP .NET MVC Text Articles • http://csharp-video-tutorials.blogspo... • All ASP .NET MVC Slides • http://csharp-video-tutorials.blogspo... • All Dot Net and SQL Server Tutorials in English • https://www.youtube.com/user/kudvenka... • All Dot Net and SQL Server Tutorials in Arabic •    / kudvenkatarabic   • In this video, we will discuss, generating a radiobuttonlist control in mvc using Html.RadioButtonFor helper. Please watch Part 36 before proceeding. • Right click on the Models folder and add a class file with name=Company.cs . Copy and paste the following code. • public class Company • { • public string SelectedDepartment { get; set; } • public List[Department] Departments • { • get • { • SampleDBContext db = new SampleDBContext(); • return db.Departments.ToList(); • } • } • } • Copy and paste the following 2 Index action methods in HomeController class. • [HttpGet] • public ActionResult Index() • { • Company company = new Company(); • return View(company); • } • [HttpPost] • public string Index(Company company) • { • if (string.IsNullOrEmpty(company.SelectedDepartment)) • { • return You did not select any department ; • } • else • { • return You selected department with ID = + company.SelectedDepartment; • } • } • Right click on the Index action method in HomeController and add a view with name=Index . Copy the index view code from by blog using the link below. • http://csharp-video-tutorials.blogspo... • Run the application and click on Submit without selecting any department. Notice that, you get a message stating you have not selected any department. On the other hand, select a department and click Submit . The selected department ID must be displayed.

#############################









Content Report
Youtor.org / YTube video Downloader © 2025

created by www.youtor.org