Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Getting value of a disabled dropdown in request object

Posted on 2004-09-10
13
Medium Priority
?
1,477 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
Technology Partners: 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 2000 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
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…
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 …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

705 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