阿贾克斯问题 [英] Ajax problem

查看:118
本文介绍了阿贾克斯问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在页面中使用Ajax从服务器端加载数据.

我有一个填充有数据的组合框,选择后它应该将所选项目发送到服务器,并获取数据以填充第二个组合框.

当选择在第二组合框的项第三组合框应填充按照所选择的项目.以同样的方式第四组合框.

问题:当选择在第一组合框的项时所有剩余的组合框控件创建重复的,并在页的顶部示出.数据正在这些组合框中填充.可能是什么问题呢?为什么会这样

我正在使用母版页,因此已将脚本管理器放置在母版页中.

相关代码示例.

I have used Ajax in my page to load the data from the server side.

I have a combobox filled with data, when selected it should send the selected item to server and get the data to fill in the second combobox.

When the item in the second combobox is selected third combobox should be filled as per the selected item. in same way fourth combobox.

Problem: when the item in the first combobox is selected all the remaining comboboxes controls are created duplicate and shown at the top of the page. the data is filling in those comoboboxes. what could be the problem? why is it so happening

I am using the master pages so that I have placed the script manager in master page.

Related code sample.

<tr>
                                    <th width="145" height="21" align="left" valign="top" scope="col">
                                    <asp:DropDownList ID="ProjectsCmb" runat="server" Width="140px"

                                        CssClass="formlines" Height="28px"

                                        onselectedindexchanged="ProjectsCmb_SelectedIndexChanged"

                                        AutoPostBack="True"  >
                                    </asp:DropDownList>&nbsp;&nbsp;
                                    </th>
                               <asp:UpdatePanel ID="UpdateFilterPanel" runat="server"  UpdateMode="Conditional" >
                                <ContentTemplate>
                                    <th width="145" height="21" align="left" valign="top" scope="col">
                                    <asp:DropDownList ID="SoftwareReleaseCmb" runat="server" Width="140px"

                                        CssClass="formlines"

                                        onselectedindexchanged="SoftwareReleaseCmb_SelectedIndexChanged"

                                        AutoPostBack="True" >
                                     </asp:DropDownList>&nbsp;&nbsp;</th>
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="ProjectsCmb" />
                                </Triggers>
                             </asp:UpdatePanel>
                              <asp:UpdatePanel ID="UpdatePanel1" runat="server"  UpdateMode="Conditional" >
                                <ContentTemplate>
                                    <th width="145" height="21" align="left" valign="top" scope="col">
                                    <asp:DropDownList ID="PhasesCmb" runat="server" Width="140px" CssClass="formlines"

                                        onselectedindexchanged="PhasesCmb_SelectedIndexChanged" AutoPostBack="True">
                                    </asp:DropDownList>&nbsp;&nbsp; </th>
                              </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="SoftwareReleaseCmb" EventName="SelectedIndexChanged" />
                                </Triggers>
                             </asp:UpdatePanel>
                              <asp:UpdatePanel ID="UpdatePanel2" runat="server"  UpdateMode="Conditional" >
                                <ContentTemplate>
                                    <th width="145" height="21" align="left" valign="top" scope="col">
                                    <asp:DropDownList ID="RolesCmb" runat="server" Width="140px" CssClass="formlines"

                                       onselectedindexchanged="RolesCmb_SelectedIndexChanged"  AutoPostBack="True">
                                    </asp:DropDownList>&nbsp;&nbsp;</th>
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="PhasesCmb" EventName="SelectedIndexChanged" />
                                </Triggers>
                             </asp:UpdatePanel>
                                    <th width="140" height="21" align="left" valign="top" scope="col">
                                    <asp:DropDownList ID="LanguagesCmb" runat="server" Width="130px"

                                        CssClass="formlines" >
                                    </asp:DropDownList></th>
                          </tr>
                          <tr>
                            <th valign="middle" align="center" colspan="5">&nbsp;
                            <asp:UpdateProgress ID="udProgress" runat="server"

                                DisplayAfter="100" Visible="true" DynamicLayout="true">
                                <ProgressTemplate>
                                    <asp:Image border="0" ImageUrl="~/Images/loading.gif" runat="server" />
                                </ProgressTemplate>
                            </asp:UpdateProgress>
                            </th>
                          </tr>

推荐答案



请在绑定之前清除下拉列表,例如:

填写1下拉菜单,清除2,3和4下拉菜单,然后绑定
fillin 2下拉列表清除3和4下拉列表,然后绑定
fillin 3下拉列表清除4然后绑定

如有任何疑问,请让我知道.

如果有帮助,请提供"投票",如果这是正确的答案,请提供"接受答案".

谢谢,
Imdadhusen
Hi,

Please clear dropdown before bind like:

fillin 1 dropdown clear 2,3 and 4 dropdown then bind
fillin 2 dropdown clear 3 and 4 dropdown then bind
fillin 3 dropdown clear 4 then bind

Please do let me know, if you have any doubt.

Please provide "Vote" if this would be helpful, and make "Accept Answer" if this would be correct answer.

Thanks,
Imdadhusen


这篇关于阿贾克斯问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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