与下拉列表相关的问题 [英] Problem related to dropdownlist

查看:73
本文介绍了与下拉列表相关的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的先生,
我有3个下拉列表. 1st包含大陆.第二个包含国家.第三名包含城市.
我想首先选择一个大陆.当我选择大陆时,我需要在国家/地区下拉列表中选择国家/地区.当我选择一个国家/地区时,受人尊敬的城市将出现在城市下拉列表中.
我已经正确地做了所有这些.但是我的问题是,当我选择一个大陆时,页面会刷新,这需要很长时间.
请给我一些小例子的帮助.
先生,请同时提供带有ajax下拉菜单的解决方案.

谢谢.
Manoj joshi

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

推荐答案

请参考:
在ASP中实现国家/州/城市下拉列表的简单方法. NET(VB) [ ^ ]
使用Asp.net数据库的Ajax级联下拉列表示例 [ ^ ]
CascadingDropDown演示 [层叠DropDownList [将CascadingDropDown与数据库一起使用 [
Please refer:
Simple Way to Implement Country/State/City Dropdown List in ASP.NET (VB)[^]
Ajax Cascading Dropdownlist Sample with database using asp.net[^]
CascadingDropDown Demonstration[^]
Cascading DropDownList[^]
Using CascadingDropDown with a Database[^]

Note: Use update panel control to stop page refersh.


使用SelectedIndexChanged事件来执行此操作.

将大洲和国家/地区下拉列表的自动回传设置为true

假设有三种方法 ShowContinent() ShowCountry() ShowCity()

在页面加载时使用ShowContinent(),在大陆下拉菜单的SelectedIndexChanged事件上使用ShowCountry(),在国家下拉列表的SelectedIndexChanged事件上使用ShowCity()

要使用Ajax刷新停止页面,请将所有三个下拉菜单放入 ContentTemplate 标签

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

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

</contenttemplate>
</updatepanel>


首先优化您的数据库!
使用关系数据库!

二次使用更新面板,如下面的代码片段所示:
first optimize your database!
use relational database!

second use update panel like below code snippet:
<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>


只需将要更新的内容放在ContentTemplate中的回调中即可.
并将触发器的controlID设置为导致回发事件的控件ID!


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!


这篇关于与下拉列表相关的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆