Solved

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

Posted on 2013-05-30
1
358 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 500 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

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…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

728 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