Click here to Skip to main content
15,905,508 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Dear sir,
I have 3 dropdown lists. 1st contains the continental. 2nd contains country. 3rd contains city.
i want to choose first a continent. when i choose continent i need country in in country dropdown. and when i choose a country a respected city will came in city dropdown list.
i have done all of these correctly. but my problem is when i am selecting a continent my page goes to refresh and it's taking a long time.
please provide me some help with the a little example.
sir please provide solution with ajax dropdown also.

thanking you.
Manoj joshi
Posted
Comments
OriginalGriff 3-Jun-12 4:36am    
And what have you tried so far?
manu027 3-Jun-12 4:50am    
sir i have used selectedindexchanged event for selecting a country, and then i am getting cities of that selected country. but i dont know how to stop page refresh

Use SelectedIndexChanged event to do this.

Set autopostback true for continent and country dropdown

Suppose there are three method ShowContinent(), ShowCountry() and ShowCity()

Use ShowContinent() on pageload, ShowCountry() on Continent dropdown's SelectedIndexChanged event and ShowCity() on Country dropdown's SelectedIndexChanged event

For stop page refresh use ajax, put all three dropdown inside ContentTemplate tag

C#
<updatepanel id="UpdatePanel1" runat="server">
<contenttemplate>

</contenttemplate>
</updatepanel>
 
Share this answer
 
first optimize your database!
use relational database!

second use update panel like below code snippet:
XML
<asp:DropDownList ID="continental" runat="server" OnSelectedIndexChanged="taha"></asp:DropDownList>

        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:DropDownList ID="country" runat="server"></asp:DropDownList>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger  ControlID="continental"                 EventName="taha"/>
            </Triggers>
        </asp:UpdatePanel>

just put the content that update in call back in ContentTemplate.
and set the controlID of your trigger to ID of control that causes the postback event!
 
Share this answer
 
Hi,

You can use refreshpanels. On the selected index change of first dropdown refresh only the second dropdown. On the selected index change of second dropdown refresh only the third dropdown,

Happy Coding :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900