Solved

cascading dropdown

Posted on 2010-09-23
6
967 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
  • 3
  • 2
6 Comments
 
LVL 5

Accepted Solution

by:
tvPrasad earned 500 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

773 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