Thứ Sáu, 31 tháng 3, 2017

Chống Refresh Page Dropdown list ASPNET

 -------------
 Không refresh toàn bộ trang khi chọn item trên dropdown 1 để load data lên dropdown 2
--------------
The ScriptManager control and the UpdatePanel control. These controls remove the requirement to refresh the whole page with each postback, which improves the user experience. By default, a postback control (such as a button) inside an UpdatePanel control causes a partial-page update. By default, a button or other control outside an UpdatePanel control causes the whole page to be refreshed,
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <fieldset>
            <div class="1">
                <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
                    <asp:ListItem Text="Select..." Value="No selection made"></asp:ListItem>
                </asp:DropDownList>
            </div>
            <div class="1">
                <asp:DropDownList ID="DropDownList2" runat="server">
                    <asp:ListItem Text="Select..." Value="No selection made"></asp:ListItem>
                </asp:DropDownList>
            </div>
        </fieldset>
    </ContentTemplate>
</asp:UpdatePanel>

Không có nhận xét nào:

Đăng nhận xét