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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:42:23+00:00 2026-05-24T18:42:23+00:00

I have made the MVC Music Store from the tutorials and am editing it

  • 0

I have made the MVC Music Store from the tutorials and am editing it and adding new features, recently I made the browse store page have links from A-Z with an All button at the end.
How can I bring up a message that says “There are no artists beginning with the letter A, B, C ” or whatever letter has been clicked with no artists.

Here is my code from my Store Index:

@model IEnumerable<MVCMusicStore.Models.Artist>
@{
    ViewBag.Title = "Store";
}

<h3>Browse Artists</h3>
@Html.ActionLink("A", "Index", new { letter = "A" })
@Html.ActionLink("B", "Index", new { letter = "B" })
@Html.ActionLink("C", "Index", new { letter = "C" })
@Html.ActionLink("D", "Index", new { letter = "D" })
@Html.ActionLink("E", "Index", new { letter = "E" })
@Html.ActionLink("F", "Index", new { letter = "F" })
@Html.ActionLink("G", "Index", new { letter = "G" })
@Html.ActionLink("H", "Index", new { letter = "H" })
@Html.ActionLink("I", "Index", new { letter = "I" })
@Html.ActionLink("J", "Index", new { letter = "J" })
@Html.ActionLink("K", "Index", new { letter = "K" })
@Html.ActionLink("L", "Index", new { letter = "L" })
@Html.ActionLink("M", "Index", new { letter = "M" })
@Html.ActionLink("N", "Index", new { letter = "N" })
@Html.ActionLink("O", "Index", new { letter = "O" })
@Html.ActionLink("P", "Index", new { letter = "P" })
@Html.ActionLink("Q", "Index", new { letter = "Q" })
@Html.ActionLink("R", "Index", new { letter = "R" })
@Html.ActionLink("S", "Index", new { letter = "S" })
@Html.ActionLink("T", "Index", new { letter = "T" })
@Html.ActionLink("U", "Index", new { letter = "U" })
@Html.ActionLink("V", "Index", new { letter = "V" })
@Html.ActionLink("W", "Index", new { letter = "W" })
@Html.ActionLink("X", "Index", new { letter = "X" })
@Html.ActionLink("Y", "Index", new { letter = "Y" })
@Html.ActionLink("Z", "Index", new { letter = "Z" })
@Html.ActionLink("All", "Index", new { letter = "all" })


<ul>
    @foreach (var artist in Model)
    {
        <li>@Html.ActionLink(artist.Name,
"Browse", new { id = artist.ArtistId })</li>
    }
</ul>

This is the code from my Controller:

    public ActionResult Index(string letter = "")
    {
        IEnumerable<Artist> artist;

        if (letter == "all")
        {
            artist = storeDB.Artists.OrderBy(x =>x.Name).ToList();
        }
        else if (letter != "")
        {
artist = storeDB.Artists.Where(a => a.Name.StartsWith(letter)).OrderBy(x => x.Name).ToList();
        }
        else
        {
            artist = new List<Artist>();
        }
  • 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-05-24T18:42:23+00:00Added an answer on May 24, 2026 at 6:42 pm
    @if(Model.Any())
    {
        foreach (var artist in Model)
        {
            <li>@Html.ActionLink(artist.Name,
    "Browse", new { id = artist.ArtistId })</li>
        }
    }
    else
    {
        <span>There are no artists</span>
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made the MVC Music Store through the tutorials and I'm now currently
I've just create a new MVC project, and have made no changes at all,
I have recently made the transition from a Java web developer to a C#
Good morning, I'm learning MVC using the music store examples on the www.asp.net/mvc page,
I have to migrate a web application I made with ASP.NET MVC to a
I have made a new windows service which works fine using barebone code (just
I have made a class which a form can inherit from and it handles
I am using asp.net mvc with jquery... I have made a json call to
We have a ASP.net MVC 3 website.We had to store many values in hidden
Why the favicon disappears Background: I have my site made according to mvc So,

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.