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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:07:28+00:00 2026-06-08T16:07:28+00:00

I have a dropdown in my page. On selecting a value in dropdown I

  • 0

I have a dropdown in my page. On selecting a value in dropdown I want the label text to be changed. Here is my code :

@model FND.Models.ViewLender

@{
    ViewBag.Title = "Change Lender";
 }

@using (Html.BeginForm())
{
    @Html.Label("Change Lender : ")
    @Html.DropDownList("Ddl_Lender", Model.ShowLenderTypes)
    @Html.DisplayFor(model => model.Description)
 }

On changing the value in dropdownlist I want the Description to change accordingly.

  • 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-08T16:07:31+00:00Added an answer on June 8, 2026 at 4:07 pm

    You could start by putting the description into a div and give your dropdown an unique id:

    @model FND.Models.ViewLender
    
    @{
        ViewBag.Title = "Change Lender";
    }
    
    @using (Html.BeginForm())
    {
        @Html.Label("Change Lender : ")
        @Html.DropDownList("Ddl_Lender", Model.ShowLenderTypes, new { id = "lenderType" })
        <div id="description">
            @Html.DisplayFor(model => model.Description)
        </div>
    }
    

    Now all that’s left is to subscribe to the onchange javascript event of this dropdown and update the corresponding description.

    For example if you are using jQuery that’s pretty trivial task:

    $(function() {
        $('#lenderType').change(function() {
            var selectedDescription = $(this).find('option:selected').text();
            $('#description').html(selectedDescription);
        });
    });
    

    This being said I probably misunderstood your question and this description must come from the server. In this case you could use AJAX to query a controller action that will return the corresponding description. All we need to do is provide the url to this action as an HTML5 data-* attribute to the dropdown to avoid hardcoding it in our javascript file:

    @Html.DropDownList(
        "Ddl_Lender", 
        Model.ShowLenderTypes, 
        new { 
            id = "lenderType", 
            data_url = Url.Action("GetDescription", "SomeController") 
        }
    )
    

    and now in the .change event we trigger the AJAX request:

    $(function() {
        $('#lenderType').change(function() {
            var selectedValue = $(this).val();
            $.ajax({
                url: $(this).data('url'),
                type: 'GET',
                cache: false,
                data: { value: selectedValue },
                success: function(result) {
                    $('#description').html(result.description);
                }
            });
        });
    });
    

    and the last step of course is to have this controller action that will fetch the corresponding description based on the selected value:

    public ActionResult GetDescription(string value)
    {
        // The value variable that will be passed here will represent
        // the selected value of the dropdown list. So we must go ahead 
        // and retrieve the corresponding description here from wherever
        // this information is stored (a database or something)
        string description = GoGetTheDescription(value);
    
        return Json(new { description = description }, JsonRequestBehavior.AllowGet);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Everyone. I have a little issue with selecting value from the dropdown list. When
I have dropdown on my page, I am changing selected value of dropdown from
I have a page that contains dynamically generated Dropdown List controls and I want
I have a dropdown on my master page that lets the user switch language
I have a jQuery dropdown menu on the same page as a jQuery search
I have a page with a single dropdown. Depending on what the user chooses
I have a php page with a dropdown list that is populated by a
I have 3 filter conditions on a web page Filter by dropdown Source Filter
On a aspx page, I have to load a DropDown with some values coming
I have a dropdown select list on my page of class=TypeFilter. I have a

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.