Solved

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

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

772 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