Solved

Getting value of a disabled dropdown in request object

Posted on 2004-09-10
13
1,470 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
Comment Utility
Use javascirpt check here:

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

Regards,

Aeros
0
 
LVL 17

Expert Comment

by:AerosSaga
Comment Utility
<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
Comment Utility
>>"I have a disabled dropdown list"<< then how are you gonna select any item from it ?
-@Baan
0
 
LVL 17

Expert Comment

by:AerosSaga
Comment Utility
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
Comment Utility
I think he disables after select baan
0
 
LVL 17

Expert Comment

by:AerosSaga
Comment Utility
after you save it then disable it

Me.MyDDL.Enabled = false
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 3

Expert Comment

by:jetforce
Comment Utility
On the serverside,

Whatistheddrowndownlistname..SelectedItem.Value

Jetforce
0
 
LVL 11

Author Comment

by:ram2098
Comment Utility
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
Comment Utility
Yes you just have to get the value then disable see above examples.
0
 
LVL 17

Expert Comment

by:AerosSaga
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
either way with that many ddl's its not gonna be pretty or fun
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now