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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:02:58+00:00 2026-05-22T02:02:58+00:00

I have an MVC3 application with Razor and I created a View that inside

  • 0

I have an MVC3 application with Razor and I created a View that inside renders a Partial View. This is how the main View looks like:

@{Html.RenderPartial("_SearchFilters", Model.SearchFilters);}

@* Other HTML elements *@

Inside the _SearchFilters Partial View I have the following DropDownLists inside a Form element:

Choose Year
          @Html.DropDownListFor(m => m.Year, new SelectList(Model.YearsList, "Value", "Text"), DateTime.Now.Year)

Choose Month
          @Html.DropDownListFor(m => m.Month, new SelectList(Model.MonthsList, "Value", "Text"), Model.Month.ToString(), new { @disabled = "disabled" })


       <input type="submit" value="Display" />

I would like that upon Submit the two DropDownLists keep their status, namely the value selected by the user, when the View is reloaded with the filtered data.

Is there any way to do it without using AJAX?

UPDATE

The ViewModel is as follows:

public class TableSearchFiltersViewModel
{
    public bool YTM { get;  set; }

    public int? Month { get; set; }

    public int? Year { get; set; }

    public IEnumerable<SelectListItem> YearsList
    {
        get
        {
        return Enumerable.Range(2011, (DateTime.Now.Year - 2011 + 4)).Select(m => new SelectListItem
        {
            Value = m.ToString(),
            Text = m.ToString(),
        }).OrderBy(m => m.Value);
        }
    }

    public IEnumerable<SelectListItem> MonthsList
    {
        get
        {
           return Enumerable.Empty<SelectListItem>();
        }
    }

}

Thanks

Francesco

  • 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-22T02:02:59+00:00Added an answer on May 22, 2026 at 2:02 am

    I don’t have IDE at this time so couldn’t test but this might work:

    Choose Month

    EDIT:

     @Html.DropDownListFor(m => m.Month, 
    Model.MonthsList.Select(
            t => new SelectListItem {
                     Text = t.Name,
                     Value = t.Value,
                     Selected = t.Value == Model.Month,
            },
    
     Model.Month.ToString(), new { @disabled = "disabled" })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Razor view in my asp.net MVC3 application with a dropdownlist like
MVC3 VB.NET Razor view Application... I have a view that uses a for each
I am working on asp.net MVC 3 application. I have created a Razor view
I have created a Razor view in my asp.net MVC 3 application. It is
I have created a website using MVC3 along with the Razor view engine. What
I have an ASP.NET MVC3 application in C# and Razor. In the view MyView
I have standard ASP.NET 4 application. Inside this application there are also few razor
I have to develop an ASP.NET MVC3 application in C# and Razor that has
I have an MVC3 application that has a custom HandleErrorAttribute so that I can
MVC3 vb.net Application using built in session management. I have an mvc3 application that

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.