0

我有两个下拉列表,两个都带有 AutoPostBack="true"。第一个下拉列表有一个客户列表,第二个有一个员工列表。

截图:

我的程序

当我在第一个下拉列表(在 fildset 1“Dados”上)选择一个项目时,fildset 2“Cliente”必须填充空白(如姓名、邮政编码、地址、电话号码等)。

但什么也没发生!有 OnSelectedIndexChange 事件和 AutoPostBack="true" 但没有任何效果。但是当我更改第二个下拉列表“Tecnico”时,第一个下拉列表着火了!

这是我的代码:

<asp:UpdatePanel ID="upGeral" runat="server">
        <ContentTemplate>
            <div >
                <h1>Relatório de Atendimento</h1>
                <br />
                <div>
                    <fieldset style="width: 90%">
                        <legend>Dados</legend>
                        <table>
                            <tr>
                                <td>
                                    <asp:Label Text="Cliente" runat="server" ID="lblCliente"></asp:Label>&nbsp;
                                </td>
                                <td colspan="3">
                                    <asp:DropDownList ID="ddlClientes" runat="server" OnSelectedIndexChanged="ddlClientes_SelectedIndexChanged" AutoPostBack="true">
                                    </asp:DropDownList>
                                    <asp:Label ID="lblIdCliente" runat="server" Height="23px"></asp:Label>
                                </td>
                                <td>
                                    <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                                        <ProgressTemplate>
                                            <img src="../Imagens/Icones/ajax-loader.gif" alt="Loading..." />
                                        </ProgressTemplate>
                                    </asp:UpdateProgress>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label runat="server" Text="Responsável" ID="lblResponsavel"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox runat="server" ID="txtResponsavel"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label runat="server" Text="Data Chegada" ID="lblDataChegada"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox runat="server" ID="txtDataChegada" onkeyup="formataData(event);" MaxLength="10"></asp:TextBox>
                                </td>
                                <td class="style3">
                                    <asp:Label runat="server" Text="Hora Chegada" onkeyup="formataHora(event);" MaxLength="5"
                                        ID="lblHoraChegada"></asp:Label>
                                </td>
                                <td class="style4">
                                    <asp:TextBox runat="server" ID="txtHoraChegada" onkeyup="formataHora(event);" MaxLength="5"
                                        Style="margin-left: 0px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label runat="server" Text="Data Saída" ID="lblDataSaida"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox runat="server" ID="txtDataSaida" onkeyup="formataData(event);" MaxLength="10"></asp:TextBox>
                                </td>
                                <td class="style3">
                                    <asp:Label runat="server" Text="Hora Saída" ID="lblHoraSaida"></asp:Label>
                                </td>
                                <td class="style4">
                                    <asp:TextBox runat="server" ID="txtHoraSaida" onkeyup="formataHora(event);" MaxLength="5"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="lblKM" runat="server" Text="KM"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtKM" runat="server" onkeyup="formataInteiro(event);"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="lblTecnico" runat="server" Text="Técnico"></asp:Label>
                                </td>
                                <td>
                                    <asp:DropDownList ID="ddlTecnico" runat="server" AutoPostBack="true">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                        </table>
                    </fieldset>
</ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="ddlClientes" />
        </Triggers>
    </asp:UpdatePanel>

我不知道我能做些什么来修复它......有人可以帮助我吗?

4

1 回答 1

0

您可以尝试将“UpdateMode”updatePanel 属性设置为“Conditional”。

于 2012-11-05T14:17:36.920 回答