?
Solved

cascading dropdown

Posted on 2010-09-23
6
Medium Priority
?
986 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

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.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

649 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