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

  • Home
  • SEARCH
  • 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 6944653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:20:05+00:00 2026-05-27T13:20:05+00:00

Situation is : when i select a value from a html.dropdown then i need

  • 0

Situation is : when i select a value from a html.dropdown then i need corresponding values stored in another table at database with in the same view in any manner (keep dropdown visible).
My consideration:: Firstly i need to pass selected value of dropdown to some controller action(using jquery handler). then that controller action must return a partial view which i can display on dropdownlist view with the help of Ajax……..need some code

  • 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-27T13:20:05+00:00Added an answer on May 27, 2026 at 1:20 pm

    You could use javascript to subscribe to the .change event of the dropdown list and trigger an AJAX request sending the selected value to the server. For example assuming you have the following dropdown (with an unique id so that it can be referenced more easily from your javascript files and an HTML5 data-* attribute pointing to the server controller action that will be invoked when the value changes):

    @Html.DropDownListFor(
        x => x.SomeProperty, 
        Model.Items, 
        new { 
            data_url = Url.Action("Foo", "SomeController"),
            id = "myddl" 
        }
    )
    

    in a separate javascript file you could subscribe to the change event:

    $(function() {
        // When the DOM is loaded subscribe to the .change event of the dropdown list
        // with id="myddl"
        $('#myddl').click(function() {
            // when the value of the dropdown changes fetch the new value
            var selectedValue = $(this).val();
    
            // fetch the url
            var url = $(this).data('url');
    
            // send the selected value to the server using a AJAX POST request
            $.post(url, { value: selectedValue }, function(result) {
               // will be called when the AJAX succeeds. Here you could process
               // any eventual results sent by the server. For example the server could
               // return some JSON object indicating whether the operation succeeded or not
            });
        });
    });
    

    which would invoke the corresponding action:

    [HttpPost]
    public ActionResult Foo(string value)
    {
        // at this stage value will equal the selected dropdown value
        // so that you can update your database and do whatever you want with it
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a situation where I want to associate multiple values from one table
I have a situation where I need to extract a value from a form
I have a situation where the second select list option is generated from the
I have a situation where I need to do something like select 2, id
I've got the following situation: var totalRecords = (from entry in invalidAccEntryRepository select entry).Where(entry
Situation: A PHP application with multiple installable modules creates a new table in database
I am in a situation where I need to run multiple times the same
My situation is that I need to get a single value that defines the
I have a query on my database as such: SELECT * FROM expenses WHERE
Bumped into a strange situation here. Trying to extract cars from a sql database

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.