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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:43:52+00:00 2026-06-06T17:43:52+00:00

I am developing an application in which i have a dropdownlist and i want

  • 0

I am developing an application in which i have a dropdownlist and i want that whenever there is any change in selection of dropdownlist the partial view for the same must be selected accordingly.

I am using dropdownlist as

 @Html.DropDownListFor(x => x.ID,
              new SelectList(new List<Object>{ new { value = 0 , text = "MCQ"  },new { value = 1 , text = "Rating Scale" },
                           new { value = 2 , text = "Comment Box"}}, "Value", "Text"),
            "Select Answer Type",
            new
            {
                id = "myddl",
                data_url = Url.Action("GetHtml", "Question")
            })

and jQuery code to track selection change event

 $(function () {
        $('#myddl').change(function () {
            var url = $(this).data('url');
            var value = $(this).val();
            $('#result').load(url)
        });
    });

And i am using action named GetHTML as

public ActionResult GetHtml(string value)
        {

            if (value== "0")
           {
             return PartialView("_OAns");
           }
            else if (value== "1")
           {
               return PartialView("_RScale");
           }
            else if (value== "2")
           {
               return PartialView("_Comments");
           }
           else
           {                   
               return View("Index");
           }
        }

The above code is working fine but when i select a value in dropdown box then its always returning this View("Index") i.e. may be its never taking a value which matches to value 1, 2 or 3

What’s the reason ? I want to apply selection change but its not happening here. Is there any problem with action or passing value ?

Please help

  • 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-06T17:43:54+00:00Added an answer on June 6, 2026 at 5:43 pm

    You’ve declared this value variable inside your change callback but you don’t seem to be doing anything with it. So do something, like for example sending it to the server:

    $(function () {
        $('#myddl').change(function () {
            var url = $(this).data('url');
            var value = $(this).val();
            $('#result').load(url, { value: value });
        });
    });
    

    Notice the second argument of the .load() function. It allows you to pass data to the server during the AJAX request.

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

Sidebar

Related Questions

I am developing an android application in which i have a local database.I want
I am developing an iphone application which have a complicated view is to display
i m developing application in which i have to change the background image on
I am developing an application in which I have to show the address that
I have heard that when developing application which uses a database you should do
I am developing an application in which i have to get data from .xls
I am developing android application in which i have to open option menu from
We are developing an application which is read heavy and could possibly have millions
i'm developing a java application in which i have a JFrame with a JDesktopPane
I am developing an application which requires to add Calendar event. I have written

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.