TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Vikas
NA
831
194.9k
Desc Order List In Dropdownlist Using .Net Core With MVC 5
Jul 13 2019 2:30 AM
I have 1 dropdownlist, In this dropdown list value is shown like Season 1, Season 2, .... Season10.
I want to display my list descending order like Season 10 , Season 9 and so on.
Here is my dropdownlist Code:-
My Controller:-
public
static
async Task
> GetSeasonList()
{
IEnumerable
_objSeasons =
null
;
using
(var _seasonsList =
new
HttpClient())
{
_seasonsList.BaseAddress =
new
Uri(
"http://localhost:59745/api/"
);
_seasonsList.DefaultRequestHeaders.Clear();
_seasonsList.DefaultRequestHeaders.Accept.Add(
new
MediaTypeWithQualityHeaderValue(
"application/json"
));
HttpResponseMessage seasons = await _seasonsList.GetAsync(
"SeasonLists"
);
if
(seasons.IsSuccessStatusCode ==
true
)
{
_objSeasons = seasons.Content.ReadAsAsync
>().Result;
}
}
return
_objSeasons ;
}
cshtml page:-
<
select
id
=
"dropdownSessionId"
class
=
"selectActive"
name
=
"seasonlist"
>
<
option
disabled selected
>
Select Season<
option
>
@foreach (var seasonslist in @Model.Seasons)
{
<
option
onchange
=
"@Seasons.SessionId"
>
@
seasonslist
.seasonName<
option
>
}
</section>
Reply
Answers (
2
)
Problem in Dynamic Menu in MVC Core
HomeFolder tag for Remote / Virtual server on usercontrol