HtmlInput Reset Problem

my dropdown country is inside the update bar and also sets the update mode conditionally. Based on the country, I populate the status dropdown menu, which is also inside the update panel, and the update condition is also set.

What I need is I want to reset the country and state dropdown menu.

I am using htmlinputbutton reset which doesn't work for this case.

+2


source to share


2 answers


I believe you need to use the asp button: and then you need to register the button click event on the refresh panel. Then you can define code on your server side client to reload the dropdown. Don't forget that your entire page will be rebuilt, and in your Page_Load you need to manage the page. IsPostback



0


source


Do something like the following:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <asp:DropDownList ID="ddlCountry" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged"></asp:DropDownList>
    <asp:DropDownList ID="ddlState" runat="server" OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged"></asp:DropDownList>
    <asp:Button ID="ButtonReset" runat="server" Text="Reset" OnClick="ButtonReset_OnClick" />
    </ContentTemplate>
</asp:UpdatePanel>

      

in ddlCountry_SelectedIndexChanged

set drop state



to ButtonReset_OnClick

reset both dropdowns

You still need to log both events with the panel set to refresh = conditional

0


source







All Articles