• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 995
  • Last Modified:

cascading dropdown

Hi experts,
I have a three cascading dropdowns for Coutry,State and City.
This works very well.
What I am trying to do is,
When 'Admin' is viewing a records of the user,those dropdowns shows values entered previously(That's done)
When normal user is viewing this form,I want to show data in readonly form,I tried to disable the dropdowns
 but it is not working.Those dropdowns should be disabled but should have value from database.

These dropdowns get data from web service.

Your help is really appreciated.
Johny Bravo
Johny Bravo
  • 3
  • 2
1 Solution
Make Dropdowns readonly for normal users. Here is how...

<HTML lang="en">
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<STYLE type="text/css">
.greyed {
color: #999999;
<SCRIPT language=JavaScript type=text/javascript>
function freezeList(whichList){
var chosen=whichList.options.selectedIndex;

<FORM name="myForm">
<SELECT name="readList" readonly>
<INPUT type="button" value="Freeze The List" onclick="freezeList(this.form.readList)">

Umar Topia.Net Full Stack DeveloperCommented:
You can use dropdown variable object name
ddlTest.Enabled = false;
By definition, a dropdown is always READONLY.
By definition, a dropdown DISABLED is not sent via FORM SUBMIT.

If you are allowing multiple then you use below technique
<FORM name="myForm" method="post">
 <SELECT name="readList[]" multiple readonly onmouseover="freezeList(this.form.elements['readList[]'])">
 <OPTION value="Red">Red</OPTION>
 <OPTION value="Green" selected>Green</OPTION>
 <OPTION value="Blue">Blue</OPTION>
 <OPTION value="Yellow" selected>Yellow</OPTION>
 <INPUT type="submit" value="SUBMIT">
 <input type="button" value="freeze" />

Hope this helps!!!
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Johny BravoAuthor Commented:
.Enabled = false don't work.It doesn't load any values then

I don't understand what you are trying to tell. sorry :)

I am posting some code.Please see.

<asp:DropDownList ID="ddlLocalCountry" runat="server" Width="130px" CssClass="inputtext">
            <cc1:CascadingDropDown ID="CDDddlLocalCountry" runat="server" Category="Country"
                TargetControlID="ddlLocalCountry" PromptText="[Select Country]" LoadingText="Loading countries..."
                ServicePath="~/HR/cascadingdataservice.asmx" ServiceMethod="GetDropDownCountries">

 <asp:DropDownList ID="ddlLocalState" onchange="ShowStateDiv()" runat="server" Width="100px" CssClass="inputtext">
                        <cc1:CascadingDropDown ID="CDDddlLocalState" runat="server" Category="State" TargetControlID="ddlLocalState"
                            ParentControlID="ddlLocalCountry" PromptText="[Select State]" LoadingText="Loading states..."
                            ServicePath="~/HR/cascadingdataservice.asmx" ServiceMethod="GetDropDownStates">

  <asp:DropDownList ID="ddlLocalCity" onchange="ShowOtherCity()" runat="server" Width="100px" CssClass="inputtext">
 <cc1:CascadingDropDown ID="CDDddlLocalCity" runat="server" Category="City" TargetControlID="ddlLocalCity"
                    ParentControlID="ddlLocalState" PromptText="[Select City]" PromptValue="0" LoadingText="Loading cities..."
                    ServicePath="~/HR/cascadingdataservice.asmx" ServiceMethod="GetDropDownCities">

Open in new window

Johny BravoAuthor Commented:
HI experts,pls give me some idea.I am lost
Johny BravoAuthor Commented:
not the exact solution but around there
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now