Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ASP.Net MVC 4 C# -- dropdown inFocus text ?

Posted on 2013-05-30
1
Medium Priority
?
369 Views
Last Modified: 2013-07-02
How can I get the attached additional text to display when a dropdown is selected ?

The text is NOT in a database.
s001.jpg
0
Comment
Question by:finance_teacher
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 23

Accepted Solution

by:
Roopesh Reddy earned 2000 total points
ID: 39253882
Hi,

You can do that using JavaScript. Check the below code -

 <select id="ddl">
        <option>N/A</option>
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
        <option>5</option>
    </select>
    <span id="msg"></span>

    <script type="text/javascript">
        window.addEventListener("change",OnChange,true);
        
        function OnChange() {
            var ddl = document.getElementById('ddl');
            switch (ddl.selectedIndex) {
                case 1:
                    document.getElementById("msg").innerHTML = "superficial or negligible damage";
                    break;
                case 2:
                    document.getElementById("msg").innerHTML = "Minor damage";
                    break;
                case 3:
                    document.getElementById("msg").innerHTML = "significant damage";
                    break;
                case 4:
                    document.getElementById("msg").innerHTML = "Repairable damage";
                    break;
                case 5:
                    document.getElementById("msg").innerHTML = "Non-Repairable damage";
                    break;
                default:
                    document.getElementById("msg").innerHTML = "";
                    break;
            }
           
        }
    </script>

Open in new window


Hope it helps u...
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question