?
Solved

cascading dropdown

Posted on 2010-09-23
6
Medium Priority
?
981 Views
Last Modified: 2013-11-07
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.
Thanks
0
Comment
Question by:johny_bravo1
[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
  • 3
  • 2
6 Comments
 
LVL 5

Accepted Solution

by:
tvPrasad earned 1500 total points
ID: 33743709
Make Dropdowns readonly for normal users. Here is how...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML lang="en">
<HEAD>
<TITLE>HTML</title>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<STYLE type="text/css">
<!--
.greyed {
color: #999999;
}
-->
</STYLE>
<SCRIPT language=JavaScript type=text/javascript>
<!--
function freezeList(whichList){
var chosen=whichList.options.selectedIndex;
whichList.onchange=function(){
whichList.options.selectedIndex=chosen;
}
whichList.className="greyed";
}
//-->
</SCRIPT>
</HEAD>
<BODY>

<FORM name="myForm">
<DIV>
<SELECT name="readList" readonly>
<OPTION>Red</OPTION>
<OPTION>Green</OPTION>
<OPTION>Blue</OPTION>
<OPTION>Yellow</OPTION>
</SELECT>
<INPUT type="button" value="Freeze The List" onclick="freezeList(this.form.readList)">
</DIV>
</FORM>

</BODY>
</HTML>
0
 
LVL 10

Expert Comment

by:Umar Topia
ID: 33743725
You can use dropdown variable object name
ddlTest.Enabled = false;
0
 
LVL 5

Expert Comment

by:tvPrasad
ID: 33743753
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>
 </SELECT>
 <INPUT type="submit" value="SUBMIT">
 <input type="button" value="freeze" />
 </FORM>

Hope this helps!!!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 8

Author Comment

by:johny_bravo1
ID: 33743973
umartopia:
.Enabled = false don't work.It doesn't load any values then

tvPrasad:
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">
            </asp:DropDownList>
            <cc1:CascadingDropDown ID="CDDddlLocalCountry" runat="server" Category="Country"
                TargetControlID="ddlLocalCountry" PromptText="[Select Country]" LoadingText="Loading countries..."
                ServicePath="~/HR/cascadingdataservice.asmx" ServiceMethod="GetDropDownCountries">
            </cc1:CascadingDropDown>



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


  <asp:DropDownList ID="ddlLocalCity" onchange="ShowOtherCity()" runat="server" Width="100px" CssClass="inputtext">
                        </asp:DropDownList>
 <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">
                </cc1:CascadingDropDown>

Open in new window

0
 
LVL 8

Author Comment

by:johny_bravo1
ID: 33754957
HI experts,pls give me some idea.I am lost
0
 
LVL 8

Author Closing Comment

by:johny_bravo1
ID: 33901510
not the exact solution but around there
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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 …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

764 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