Drop Down Select Index Change with Ajax Update Progress


--Update Panel with Update Progress
.aspx page
<div title="Update Panel with Update Progress">
    <asp:UpdateProgress AssociatedUpdatePanelID="upMainPracticeCountry" runat="server" ID="UpdateProgress2">
                    <ProgressTemplate>
                        <img src="images/pbar2.gif" alt="loading..." />ProgressTemplate>
     asp:UpdateProgress>
                <asp:UpdatePanel ID="upMainPracticeCountry" runat="server">
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="ddlPostalCountry" EventName="SelectedIndexChanged" />
                    Triggers>
                    <ContentTemplate>
                        <asp:DropDownList ID="ddlPostalCountry" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlMainPracticeState_SelectedIndexChanged">
                        asp:DropDownList>
                    ContentTemplate>
                asp:UpdatePanel>

            <asp:UpdateProgress runat="server" ID="up2" AssociatedUpdatePanelID="upPostalCountry" DisplayAfter="2000" DynamicLayout="true">
                <ProgressTemplate>
                    <img src="images/progressbar3.gif" alt="loading..." />ProgressTemplate>
            asp:UpdateProgress>
            <asp:UpdatePanel ID="upPostalCountry" runat="server" UpdateMode="Conditional">
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="ddlPostalCountry" EventName="SelectedIndexChanged" />
                Triggers>
                <ContentTemplate>
                    <asp:DropDownList ID="ddlPostalState" runat="server">asp:DropDownList>
                ContentTemplate>
            asp:UpdatePanel>
    div>

--Update Panel without Update Progress
<div title="Update Panel without Update Progress">
   
                <asp:UpdatePanel ID="upMainPracticeCountry" runat="server">
                   
                    <ContentTemplate>
                        <asp:DropDownList ID="ddlPostalCountry" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlMainPracticeState_SelectedIndexChanged">
                        asp:DropDownList>
                    ContentTemplate>
                asp:UpdatePanel>

            <asp:UpdatePanel ID="upPostalCountry" runat="server">
                <ContentTemplate>
                    <asp:DropDownList ID="ddlPostalState" runat="server">asp:DropDownList>
                ContentTemplate>
            asp:UpdatePanel>
    div>

.aspx.cs page

    protected void ddlMainPracticeState_SelectedIndexChanged(object sender, EventArgs e)
    {
        //System.Threading.Thread.Sleep(3000);
        ddlPostalState.Items.Clear();
        BindState ();
    }

  protected void BindState ()
    {
        Do your code here…
    }



    

Comments