In my MVC application, I am generating a Radiobuttonlist dynamically from the database. There are 15 records but I want to display just first 5 of them. Is it possible to do this using RadiobuttonlistFor or any other way?
Thanks.
Wherever you are generating or using the collection which holds the list of radio button list items, you may use LINQ Take
method to get only 5.
yourRadioButtonList = yourRadioButtonList.Take(5);
Assuming yourRadioButtonList is of type IEnumerable<T>