Solved

Getting value of a disabled dropdown in request object

Posted on 2004-09-10
13
1,476 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

615 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