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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:06:03+00:00 2026-06-10T10:06:03+00:00

I am trying to pass a Form value CustomerID (i.e.dropdownlist selected value) using Ajax.Actionlink

  • 0

I am trying to pass a Form value “CustomerID” (i.e.dropdownlist selected value) using Ajax.Actionlink in MVC 4. Can someone tell me what I am doing wrong here?

<div class="editor-label">
    @Html.LabelFor(model => model.CustomerID, "Customer Name")
</div>
<div class="editor-field">
    @Html.DropDownListFor(model => model.CustomerID, Model.CustomersList, "-- Select --")
    @Html.ValidationMessageFor(model => model.CustomerID)
</div>

<div id="ApptsForSelectedDate">
   @Ajax.ActionLink("Click here to view appointments",
                    "AppointmentsList",
                    new {id = Model.CustomerID},
                    new AjaxOptions
                    {
                       UpdateTargetId = "ApptsForSelectedDate",
                       HttpMethod = "GET",
                       InsertionMode = InsertionMode.Replace,
                       LoadingElementId = "progress"
                    }
                  )            
</div>
<div id="progress">
   <img src="../../Images/ajax-loader.gif" alt="loader image" />
</div>

My controller method looks like this:

public PartialViewResult AppointmentsList(int id)
{   ... }
  • 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-10T10:06:05+00:00Added an answer on June 10, 2026 at 10:06 am

    You should use an Ajax.BeginForm and put the dropdown inside the form. This way the value will be automatically passed.

    Unfortunately since you cannot nest html forms if you already have another form wrapping this markup you cannot use a nested form.

    In this case you could use a normal link:

    @Html.ActionLink(
        "Click here to view appointments", 
        "AppointmentsList", 
        null, 
        new { id = "applink" }
    )
    

    and in a separate javascript file AJAXify it and append the necessary information to the query string by reading the selected dropdown value at the moment the AJAX request is sent:

    $(function() {
        $('#applink').click(function() {
            $('#progress').show();
            $.ajax({
                url: this.href,
                type: 'GET',
                data: { id: $('#CustomerID').val() },
                complete: function() {
                    $('#progress').hide();
                },
                success: function(result) {
                    $('#ApptsForSelectedDate').html(result);
                }
            });
            return false;
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to pass a form's data to my controller method using JQuery Ajax,
I am trying to implement ajax in jsp(avoid form submit) using struts2. I used
I am trying to pass form's data to jquery ajax request . i find
i am trying to pass a value form one div to another. the first
I am using this code. Trying to pass form values from one internal page
I'm using Awesomium WebControl on a Form in C# and i'm trying to pass
I'm using JSP and jQuery Autocomplete UI. I'm trying to pass the 'value' of
In ASP.net MVC: How should/Can I pass Form data (From the View) to the
I am trying to pass a selected checkbox value from one page to another
I am trying to pass a value from a form to a function, process

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.