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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:43:30+00:00 2026-05-30T23:43:30+00:00

I have a dropdown and when I select an item from it, I want

  • 0

I have a dropdown and when I select an item from it, I want to pass on the selected value to a function in a controller, query the db and auto load a text box with query results.

How do I use Ajax to make that call to the controller when there is onclick() event on the dropdown?

My dropdown and textbox in my aspx page is:

 <%: Html.DropDownListFor(model => model.ApplicationSegmentGuid, Model.ApplicationSegment)%>

   <%: Html.TextAreaFor(model => model.EmailsSentTo, false, new { style = "width:500px;   height:50px;" })%>

My function in controller is

 public ActionResult AsyncFocalPoint(Nullable<Guid> ApplicationSegmentGuid)
    {
        string tempEmail = UnityHelper.Resolve<IUserDirectory>().EmailOf();
        tempEmail = "subbulakshmi.kailasam@lyondellbasell.com" + tempEmail;

        IList<string> EmailAddresses = new List<String>();

        using (TSADRequestEntities context = UnityHelper.Resolve<TSADRequestEntities>())
        {
            EmailAddresses = context.FOCALPOINTs.Where(T => T.APPLICATIONSEGMENT.ItemGuid == ApplicationSegmentGuid && T.FlagActive)
                      .Select(T => T.Email).ToList();
        }
        foreach (string emailAddress in EmailAddresses)
            tempEmail = tempEmail + ";" + emailAddress;

        return Json(tempEmail, JsonRequestBehavior.AllowGet);
    }
  • 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-30T23:43:31+00:00Added an answer on May 30, 2026 at 11:43 pm

    You could give your dropdown an id and url:

    <%= Html.DropDownListFor(
        model => model.ApplicationSegmentGuid, 
        Model.ApplicationSegment,
        new { id = "myddl", data_url = Url.Action("AsyncFocalPoint") }
    ) %>
    

    and then subscribe to the .change() event of the dropdown list unobtrusively and trigger the AJAX request:

    $(function() {
        $('#myddl').change(function() {
            // get the selected value of the ddl
            var value = $(this).val();
    
            // get the url that the data-url attribute of the ddl
            // is pointing to and which will be used to send the AJAX request to
            var url = $(this).data('url');
    
            $.ajax({
                url: url,
                type: 'POST', 
                data: { applicationSegmentGuid: value },
                success: function(result) {
                    // TODO: do something with the result returned by the server here
                    // for example if you wanted to show the results in your textarea
                    // you could do this (it might be a good idea to override the id
                    // of the textarea as well the same way we did with the ddl):
                    $('#EmailsSentTo').val(result);
                }
            });
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an issue regarding to auto populating a select dropdown from jQuery/JSON data
I have a little dropdown menu similar <select> , which contolled from external js-function.
So I have a dropdown list <select id=theSelectId> <option value=volvo>Volvo</option> <option value=saab>Saab</option> <option value=mercedes>Mercedes</option>
if i have a dropdown with the following html: <select id=myDropdown name=myDropdown> <option value=6>Six</option>
I have this HTML dropdown: <form> <input type=text id=realtxt onkeyup=searchSel()> <select id=select name=basic-combo size=1>
I have a dropdown box which is used to select a user from a
i have a time dropdown that shows hour in one select, minutes in another
On my page I have a drop-down select box, with a default value of
Suppose I have a drop-down list like: <select id='list'> <option value='1'>Option A</option> <option value='2'>Option
I have two models, user & offline_user, and I want to use a dropdown

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.