Solved

Getting value of a disabled dropdown in request object

Posted on 2004-09-10
13
1,472 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
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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

803 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