Click here to Skip to main content
15,881,380 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: EntityFramework: Can we minimize sorting code Pin
Mou_kol7-Feb-18 20:40
Mou_kol7-Feb-18 20:40 
GeneralRe: EntityFramework: Can we minimize sorting code Pin
Richard Deeming8-Feb-18 1:39
mveRichard Deeming8-Feb-18 1:39 
GeneralRe: EntityFramework: Can we minimize sorting code Pin
Mou_kol8-Feb-18 1:52
Mou_kol8-Feb-18 1:52 
GeneralRe: EntityFramework: Can we minimize sorting code Pin
Richard Deeming8-Feb-18 1:58
mveRichard Deeming8-Feb-18 1:58 
QuestionAny free health monitoring dashboard exist Pin
Mou_kol5-Feb-18 22:00
Mou_kol5-Feb-18 22:00 
AnswerRe: Any free health monitoring dashboard exist Pin
Richard MacCutchan5-Feb-18 23:29
mveRichard MacCutchan5-Feb-18 23:29 
QuestionSending a collection of objects to the view in MVC Pin
Davstr5-Feb-18 4:42
Davstr5-Feb-18 4:42 
AnswerRe: Sending a collection of objects to the view in MVC Pin
Richard Deeming5-Feb-18 8:25
mveRichard Deeming5-Feb-18 8:25 
You're looping through the rooms, but you're overwriting the EastSouth list each time.

You're also passing a string as the only parameter to the SelectList constructor. This will call the SelectList(IEnumerable)[^] overload, which will create a list item for each character in the string.

Change your code to pass the list of rooms to the SelectList constructor, along with the name of the property which contains the value and the text:
C#
var AvailRoom = db.Rooms
    .Where(s => s.IsOccupied == false)
    .Where(s => s.RoomNum > 101 && s.RoomNum < 126)
;

ViewBag.EastSouth = new SelectList(AvailRoom, "RoomNum", "RoomNum");




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Sending a collection of objects to the view in MVC Pin
Davstr5-Feb-18 18:24
Davstr5-Feb-18 18:24 
QuestionASP.Net MVC:clicking on routelink url not passing all the data to action Pin
Mou_kol5-Feb-18 3:50
Mou_kol5-Feb-18 3:50 
AnswerRe: ASP.Net MVC:clicking on routelink url not passing all the data to action Pin
Richard Deeming5-Feb-18 8:17
mveRichard Deeming5-Feb-18 8:17 
GeneralRe: ASP.Net MVC:clicking on routelink url not passing all the data to action Pin
Mou_kol5-Feb-18 21:56
Mou_kol5-Feb-18 21:56 
QuestionHow to calculate page no for newly inserted records Pin
Mou_kol5-Feb-18 2:54
Mou_kol5-Feb-18 2:54 
AnswerRe: How to calculate page no for newly inserted records Pin
Maciej Los5-Feb-18 3:23
mveMaciej Los5-Feb-18 3:23 
Questionasp.net mvc routing with two controller reference Pin
Mou_kol5-Feb-18 1:18
Mou_kol5-Feb-18 1:18 
AnswerRe: asp.net mvc routing with two controller reference Pin
Richard Deeming5-Feb-18 8:09
mveRichard Deeming5-Feb-18 8:09 
GeneralRe: asp.net mvc routing with two controller reference Pin
Mou_kol5-Feb-18 21:54
Mou_kol5-Feb-18 21:54 
GeneralRe: asp.net mvc routing with two controller reference Pin
Richard Deeming6-Feb-18 2:11
mveRichard Deeming6-Feb-18 2:11 
GeneralRe: asp.net mvc routing with two controller reference Pin
Mou_kol6-Feb-18 2:38
Mou_kol6-Feb-18 2:38 
GeneralRe: asp.net mvc routing with two controller reference Pin
Richard Deeming6-Feb-18 2:50
mveRichard Deeming6-Feb-18 2:50 
QuestionWhat is Kubernetes and its usage Pin
Mou_kol4-Feb-18 22:11
Mou_kol4-Feb-18 22:11 
AnswerRe: What is Kubernetes and its usage Pin
Richard MacCutchan4-Feb-18 23:04
mveRichard MacCutchan4-Feb-18 23:04 
GeneralRe: What is Kubernetes and its usage Pin
Mou_kol5-Feb-18 0:36
Mou_kol5-Feb-18 0:36 
GeneralRe: What is Kubernetes and its usage Pin
Richard MacCutchan5-Feb-18 0:42
mveRichard MacCutchan5-Feb-18 0:42 
Questionwhat is needed to create a payment getway? Pin
Ayrton Yagami2-Feb-18 6:34
Ayrton Yagami2-Feb-18 6:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.