Solved

Getting value of a disabled dropdown in request object

Posted on 2004-09-10
13
1,475 Views
Last Modified: 2012-06-21
I have a disabled dropdown list. How can i get its selected value in the request object???
0
Comment
Question by:ram2098
[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
13 Comments
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12026014
Use javascirpt check here:

http://forums.aspfree.com/archive/t-21487

Regards,

Aeros
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12026119
<html>
<head>
    <title>Disable Controls Example</title>
    <script language="JavaScript" type="text/javascript">
    function List1_Changed()
    {
        var selectedValue = document.form1.List1[document.form1.List1.selectedIndex].value;
        if (selectedValue == 2)
        {
            // Disable controls
            document.form1.txtTest.disabled = true;
        }
        else
        {
            // Enable controls    
            document.form1.txtTest.disabled = false;
        }
    }
    </script>
</head>
<body>
<form name="form1" method="post" action="">
  <select name="List1" onChange="List1_Changed();">
    <option value="1">1</option>
    <option value="2">2</option>
  </select>
    <input name="txtTest" type="text" id="txtTest">
</form>
</body>
</html>
0
 
LVL 18

Expert Comment

by:DotNetLover_Baan
ID: 12026134
>>"I have a disabled dropdown list"<< then how are you gonna select any item from it ?
-@Baan
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Expert Comment

by:AerosSaga
ID: 12026143
or set autopostback = true, then on selected index change save your ddl value to session or write it to your db.

Sesion("MyDDLValue") = Me.MyDDL.SelectedValue

Regards,

Aeros
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12026147
I think he disables after select baan
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12026160
after you save it then disable it

Me.MyDDL.Enabled = false
0
 
LVL 3

Expert Comment

by:jetforce
ID: 12026167
On the serverside,

Whatistheddrowndownlistname..SelectedItem.Value

Jetforce
0
 
LVL 11

Author Comment

by:ram2098
ID: 12026267
Is there any way to get the value in the code behind without bringing the java script to picture.

Basically i select something and then disable it. Then i want to get the selectedtext.
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12026282
Yes you just have to get the value then disable see above examples.
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12026287
use the selected index changed event of the ddl and set autopostback=true.  Which is javascript by the way the IDE just does it for you;)
0
 
LVL 11

Author Comment

by:ram2098
ID: 12026348
I have some 50 ddls in my application ......would it be feasible to fire selectedchangeevent for all the ddls
0
 
LVL 17

Accepted Solution

by:
AerosSaga earned 500 total points
ID: 12026370
thats a lot of postbacks its kind of a judgement call, I'd use this javascript routine instead, but thats enitrely up to you.

 <html>
<head>
    <title>Disable Controls Example</title>
    <script language="JavaScript" type="text/javascript">
    function List1_Changed()
    {
        var selectedValue = document.form1.List1[document.form1.List1.selectedIndex].value;
        if (selectedValue == 2)
        {
            // Disable controls
            document.form1.txtTest.disabled = true;
        }
        else
        {
            // Enable controls    
            document.form1.txtTest.disabled = false;
        }
    }
    </script>
</head>
<body>
<form name="form1" method="post" action="">
  <select name="List1" onChange="List1_Changed();">
    <option value="1">1</option>
    <option value="2">2</option>
  </select>
    <input name="txtTest" type="text" id="txtTest">
</form>
</body>
</html>
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12026383
either way with that many ddl's its not gonna be pretty or fun
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
LINQ Select all records by MAX data syntax help 1 51
ASP.NET MVC - Views 3 62
Calculating percentage 2 49
Build a string of emails from a gridview 2 31
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…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

752 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