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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:45:03+00:00 2026-06-11T02:45:03+00:00

I’m building a page within an MVC application that contains a drop down box

  • 0

I’m building a page within an MVC application that contains a drop down box that allows the user to select a from a number of financial periods.

For the purposes of making it clearer for our users, I’d like to append “(Current)” to the option that is the current financial period and potentially “(Latest)” to the previous period to represent the last full period. We can already determine which financial period we are in and subsequently the one previous and so on.

So let’s say the two options I’m looking to append to currently look like this:

  • Period 11
  • Period 12

and I’d like it them to read:

  • Period 11 (Latest)
  • Period 12 (Current)

The drop down is populated from a database, but I would like to append this text at the application level.

Is this something that is possible? If so, how? I’m at a bit of a loss as to how to go about it.

Thanks for any help in advance.

  • 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-06-11T02:45:05+00:00Added an answer on June 11, 2026 at 2:45 am

    I assume you’re using some sort of IEnumerable on your model/view model class to populate the items in the drop-down. When you construct this list, simply add your “(Current)” and “(Latest)” options before returning the model to your view. If FinancialPeriod is a model/view model class like this:

    public class FinancialPeriod{
        public int FinancialPeriodId { get; set; }
        public string DisplayText { get; set; }
    }
    

    Then you could do this in your controller, assuming that your list of all Financial Periods retrieved from the database is a property on your model called FinancialPeriods:

    public ActionResult Index(){
        var model = GetTheModel();
        model.FinancialPeriods.Add(new FinancialPeriod{ 
            FinancialPeriodId = <something>, 
            DisplayText = "(Current)"
        };
        model.FinancialPeriods.Add(new FinancialPeriod{
            FinancialPeriodId = <somethingElse>
            DisplayText = "(Latest)"
        };
        return View(model);
    }
    

    Make sure you substitute values for <something> and <somethingElse> that you can interpret correctly when the model is posted back to your controller.

    Edit – based on your comments and edits, something like this is more appropriate:

    public ActionResult Index(){
        var model = GetTheModel();
        var currentMonth = DateTime.Now.Month;
        var previousMonth = currentMonth - 1;
        if (previousMonth == 0)
            previousMonth = 12;
        var currentPeriod = "Period " + currentMonth.ToString();
        var latestPeriod = "Period " + previousMonth.ToString();
        var newList = new List<FinancialPeriod>();
        foreach(var period in model.FinancialPeriods){
            if(period.DisplayText == currentPeriod)
            {
                newList.Add(new FinancialPeriod
                    { 
                        FinancialPeriodId = period.FinancialPeriodId,
                        DisplayText = period.DisplayText + " (Current)"
                    };
                    continue;
            }
            if(period.DisplayText == latestPeriod) 
            {
                newList.Add(new FinancialPeriod
                    {
                        FinancialPeriodId = period.FinancialPeriodId, 
                        DisplayText = period.DisplayText + " (Latest)"
                    };
                continue;
            }
            newList.Add(period);
        }
        model.FinancialPeriods = newList;
        return View(model);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
We're building an app, our first using Rails 3, and we're having to build

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.