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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:20:19+00:00 2026-06-14T09:20:19+00:00

I need to put this value: @Html.DropDownList(region, new[]{ new SelectListItem() { Text = MA,

  • 0

I need to put this value:

  @Html.DropDownList("region", new[]{ 
           new SelectListItem() { Text = "MA", Value = "MA" },
                new SelectListItem() { Text = "BC", Value = "BC" },
                     new SelectListItem() { Text = "ON", Value = "ON" },

          })

into here:

@Html.ActionLink("<<", "List", new { page = 1, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter, zipCode = ViewData["zipCode"], searchType = ViewData["searchType"], distance = ViewData["distance"], region = ViewData["region"], country = ViewData["country"] })

ViewData[“region”] is null and I cannot get the value, when I click the link. How do I put the DropDownList’s region value into the query string? I set the region to a default of MA in my code:

public ViewResult List(string sortOrder, string currentFilter, string searchString, int? page, string zipCode, string region, int? distance, string searchType, string country)
    {
        _storeService = new StoreService();

         //sets defaults
         if (String.IsNullOrEmpty(zipCode))
         {
             zipCode = "02472";
         }

         if (String.IsNullOrEmpty(region))
         {
             region = "MA";
         }
    }
  • 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-14T09:20:20+00:00Added an answer on June 14, 2026 at 9:20 am

    Since you can’t set the URL on page load, I’d just add a click listener to the anchor tag, and update the link there:

    @Html.ActionLink("<<", "List", new { ... },
        new { onclick = "updateLink(this);" })
    

    The handler should retrieve the region from the regions drop-down, and update the link’s href:

    function updateLink(anchor) {
        var select = document.getElementById('region');
        var region = select.options[select.selectedIndex].value;
        anchor.href = e.href + "&region=" + region;
    }
    

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This code i put it in the HTML page for check the file value,
The value of ig is being transfered fine, but I need to put this
I need to put a one second delay in this jQuery function so that
Kind of need help understanding what this code actually outputs. Does it out put
I need to put several folders into artifact archive. Now I am doing it
I need to put one of my test cases into a pending state. I
I'm new to MVC. I've got this all working nicely except when the page
i need to get the closest class html from my list, but its always
This is the source of my simple HTML page (save as .html file): <!DOCTYPE
I have below html code <div id=divTest> Hello <input type=text id=txtID value= /> <input

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.