title: why page scrolls back on selected index change event?
body: <p>This form works fine but it scrolls every time when I select drop down box, it scrolls to top.</p>
  
  <pre><code>&lt;asp:UpdatePanel ID="updGridViewSMS" runat="server" UpdateMode="Conditional"&gt;
            &lt;ContentTemplate&gt;
              &lt;label&gt;&lt;b&gt;Search By Date Range&lt;/b&gt;&lt;/label&gt;
              &lt;asp:Label ID="lblDateFrom" runat="server" Text="From"&gt;&lt;/asp:Label&gt;
              &lt;asp:TextBox ID="txtFromDate" runat="server" &gt;&lt;/asp:TextBox&gt;                      
              &lt;asp:CalendarExtender ID="CalendarExtenderFromDate" Format="dd/MMM/yyyy" TargetControlID="txtFromDate" runat="server"&gt;
              &lt;/asp:CalendarExtender&gt;
              &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" 
                                  ControlToValidate="txtFromDate" Display="None" ErrorMessage="" 
                                  ForeColor="Red" &gt;
              &lt;/asp:RequiredFieldValidator&gt;
              &lt;asp:Label ID="lblDateTo" runat="server" Text="To"&gt;&lt;/asp:Label&gt;
              &lt;asp:TextBox ID="txtToDate" runat="server"&gt;&lt;/asp:TextBox&gt;
              &lt;asp:CalendarExtender ID="CalendarExtenderToDate" Format="dd/MMM/yyyy" TargetControlID="txtToDate" runat="server"&gt;
              &lt;/asp:CalendarExtender&gt;
              &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" 
                                  ControlToValidate="txtToDate" Display="None" ErrorMessage="" 
                                  ForeColor="Red" &gt;
              &lt;/asp:RequiredFieldValidator&gt;
              &lt;asp:Button ID="btnSearchByDate"  CssClass="btn btn-success" runat="server" Text="Search" 
                          ClientIDMode="Static"  OnClick="btnSearchByDate_Click" /&gt;
              &amp;nbsp; 
              &lt;%--&lt;asp:Button ID="btnEdit"  CssClass="btn btn-success" runat="server" Text="Edit" 
                          ClientIDMode="Static" OnClick="btnEdit_Click"  /&gt;--%&gt;
  
              &lt;asp:ValidationSummary
               HeaderText="Requires Date Range:"
               DisplayMode="SingleParagraph"
               EnableClientScript="true"
               ForeColor="Red"
               runat="server" ID="ValidationSummary1"/&gt;
             &lt;label runat="server" id="lblSelectionMessage" style="color:navy; font-size:12px; font-style:italic" visible="false"&gt;
  
             &lt;/label&gt;
             &lt;asp:GridView ID="GridViewSmsComplaints" AllowPaging="True" PageSize="5" runat="server" AutoGenerateColumns="False"   Width="1085px" OnRowDataBound="GridViewSmsComplaints_RowDataBound" OnPageIndexChanging="GridViewSmsComplaints_PageIndexChanging" CellPadding="4" Height="417px" ForeColor="#333333" GridLines="None" &gt;
                 &lt;FooterStyle BackColor="#990000" ForeColor="White" Font-Bold="True" /&gt;
                 &lt;HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /&gt;
                 &lt;PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" /&gt;
              &lt;PagerTemplate&gt;
              &lt;table&gt;
                  &lt;tr&gt;
                      &lt;td&gt;
                          &lt;asp:LinkButton ID="lnkFirstPage" CommandName="Page" CommandArgument="First" runat="server"&gt;First&lt;/asp:LinkButton&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;asp:LinkButton ID="lnkNextPage" CommandName="Page" CommandArgument="Next" runat="server"&gt;Next&lt;/asp:LinkButton&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;asp:LinkButton ID="lnkPrevPage" CommandName="Page" CommandArgument="Prev" runat="server"&gt;Previous&lt;/asp:LinkButton&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;asp:LinkButton ID="lnkLastPage" CommandName="Page" CommandArgument="Last" runat="server"&gt;Last&lt;/asp:LinkButton&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
          &lt;/PagerTemplate&gt;
                 &lt;AlternatingRowStyle BackColor="White" /&gt;
                 &lt;Columns&gt;
                      &lt;asp:BoundField HeaderText="Sms ID" DataField="ID" /&gt; 
                      &lt;asp:BoundField HeaderText="Recieving Date" DataField="RecievingDate" /&gt;  
                      &lt;%--&lt;asp:BoundField HeaderText="ToMobileNo" DataField="ToMobileNo" /&gt;  --%&gt;
                      &lt;asp:BoundField HeaderText="Complainant Mob No." DataField="FromMobileNo" /&gt; 
                      &lt;asp:BoundField HeaderText="Complaint" DataField="Message" &gt;   
                       &lt;ItemStyle Wrap="True" /&gt;
                      &lt;/asp:BoundField&gt;
                      &lt;asp:TemplateField HeaderText="Complete/InComplete"&gt;
                       &lt;ItemTemplate&gt;
                         &lt;%--&lt;asp:CheckBox ID="ckboxIsComplaint"  runat="server" /&gt;--%&gt;
                         &lt;asp:DropDownList ID="ddlIsComplaint" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlIsComplaint_SelectedIndexChanged"&gt;
                          &lt;asp:ListItem Text="-Select-" Value="-1"&gt;&lt;/asp:ListItem&gt;
                          &lt;asp:ListItem Text="InComplete" Value="0"&gt;&lt;/asp:ListItem&gt;
                          &lt;asp:ListItem Text="Complete" Value="1"&gt;&lt;/asp:ListItem&gt;
                          &lt;asp:ListItem Text="Inappropriate" Value="-3"&gt;&lt;/asp:ListItem&gt;
                         &lt;/asp:DropDownList&gt;
                       &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                 &lt;/Columns&gt;
                 &lt;RowStyle ForeColor="#333333" BackColor="#FFFBD6" /&gt;
                 &lt;SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" /&gt;
                 &lt;SortedAscendingCellStyle BackColor="#FDF5AC" /&gt;
                 &lt;SortedAscendingHeaderStyle BackColor="#4D0000" /&gt;
                 &lt;SortedDescendingCellStyle BackColor="#FCF6C0" /&gt;
                 &lt;SortedDescendingHeaderStyle BackColor="#820000" /&gt;
              &lt;/asp:GridView&gt;    
  
          &lt;br /&gt;
        &lt;asp:Panel ID="pnlBoxesDropDowns" runat="server"&gt;
          &lt;label&gt;Complainant&lt;/label&gt;
          &lt;asp:TextBox ID="txtComplainant" runat="server" &gt;&lt;/asp:TextBox&gt;
          &lt;asp:RequiredFieldValidator ID="ReqFieldValdiatorComplainant" runat="server" ControlToValidate="txtComplainant" ErrorMessage="Complainant is Required" ForeColor="Red" SetFocusOnError="True" ValidationGroup="Complaints"&gt;Complainant is Required
          &lt;/asp:RequiredFieldValidator&gt;
          &lt;label&gt;Relevant Region&lt;/label&gt;
          &lt;asp:DropDownList ID="ddlRegions" runat="server" CssClass="DropDown_Width" Width="147px" OnSelectedIndexChanged="ddlRegions_SelectedIndexChanged" AppendDataBoundItems="True"  AutoPostBack="true" &gt;
            &lt;asp:ListItem Value="-1" Selected="True"&gt;-Select-&lt;/asp:ListItem&gt;
          &lt;/asp:DropDownList&gt;
          &lt;asp:RequiredFieldValidator ID="ReqFieldValidatorRegions" runat="server" 
           ControlToValidate="ddlRegions" ErrorMessage="Region is Required" InitialValue="-1"
           ForeColor="Red" ValidationGroup="Complaints"&gt;Region is Required&lt;/asp:RequiredFieldValidator&gt;
          &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
          &lt;asp:Label ID="lblRelevantDistrict" runat="server"&gt;District&lt;/asp:Label&gt; 
          &lt;asp:DropDownList ID="ddlDistricts" runat="server" CssClass="DropDown_Width" Width="127px" OnSelectedIndexChanged="ddlDistricts_SelectedIndexChanged" AutoPostBack="true"&gt;
          &lt;/asp:DropDownList&gt;
          &lt;asp:RequiredFieldValidator ID="ReqFieldValidatorDistricts" runat="server" 
           ControlToValidate="ddlDistricts" ErrorMessage="Region is Required" InitialValue="-1"
           ForeColor="Red" ValidationGroup="Complaints"&gt;District is Required&lt;/asp:RequiredFieldValidator&gt;
         &lt;label&gt;Relevant P.Station&lt;/label&gt; 
          &lt;asp:DropDownList ID="ddlPoliceStations" AutoPostBack="true" runat="server" Width="147px" CssClass="DropDown_Width" OnSelectedIndexChanged="ddlPoliceStations_SelectedIndexChanged"&gt;
          &lt;/asp:DropDownList&gt;
          &lt;asp:RequiredFieldValidator ID="ReqFieldValidatorPoliceStations" runat="server" 
           ControlToValidate="ddlPoliceStations" ErrorMessage="Police Station is Required" InitialValue="-1"
           ForeColor="Red" ValidationGroup="Complaints"&gt;Police Station is Required&lt;/asp:RequiredFieldValidator&gt;
            &lt;asp:label ID="lblPriority" runat="server"&gt;Priority&lt;/asp:label&gt;
            &lt;asp:DropDownList ID="ddlPriority" runat="server" Width="127px"&gt;
                &lt;asp:ListItem Text="Top" Value="1"&gt;&lt;/asp:ListItem&gt;
                &lt;asp:ListItem Text="Normal" Value="2"&gt;&lt;/asp:ListItem&gt;
            &lt;/asp:DropDownList&gt;
            &amp;nbsp;
          &lt;/asp:Panel&gt;
          &lt;br /&gt;
          &lt;br /&gt;
              &lt;asp:Timer runat="server" Enabled="false" Interval="240000" ID="RefreshSmsComplaints" OnTick="RefreshSmsComplaints_Tick" /&gt;
            &lt;/ContentTemplate&gt;
              &lt;Triggers&gt;
                  &lt;asp:AsyncPostBackTrigger ControlID="RefreshSmsComplaints" EventName="Tick" /&gt;
              &lt;/Triggers&gt;
           &lt;/asp:UpdatePanel&gt;
          &lt;asp:Button ID="btnDone" ValidationGroup="Complaints"  runat="server" CssClass="btn btn-success"  
              OnClick="btnDone_Click" Text="Done" /&gt;
  </code></pre>
  
  <p>Codebehind:</p>
  
  <pre><code>    protected void ddlRegions_SelectedIndexChanged(object sender, EventArgs e)
      {
          //Loads Districts Drop Down List When Relevant Region is Clicked
          ddlDistricts.Visible = true;
          lblRelevantDistrict.Visible = true;
          GridViewSmsComplaints.Visible = true;
  
          try
          {
              if (ddlDistricts.SelectedValue == "0")
              {
                  ddlDistricts.SelectedValue = "-1";
              }
              else
              {
                  ddlDistricts.DataTextField = "Name";
                  ddlDistricts.DataValueField = "DistrictID";
                  ddlDistricts.DataSource = mngRecievedMsg.FillDropDown_Districts(Convert.ToInt16(ddlRegions.SelectedValue));
                  ddlDistricts.DataBind();
                  ListItem list = new ListItem("-Select-", "-1");
                  ddlDistricts.Items.Insert(0, list);
              }
          }
          catch (Exception) 
          {
  
          }
  
      }
      protected void ddlDistricts_SelectedIndexChanged(object sender, EventArgs e)
      {
          //Loads police Stations Drop Down List When Relevant Region is Clicked
  
          updGridViewSMS.Visible = true; 
          try
          {
              if (ddlPoliceStations.SelectedValue == "0")
              {
                  ddlPoliceStations.SelectedValue = "-1";
              }
              else
              {
                  ddlPoliceStations.DataTextField = "Name";
                  ddlPoliceStations.DataValueField = "ID";
                  ddlPoliceStations.DataSource = mngRecievedMsg.GetHomePoliceStation(Convert.ToInt16(ddlDistricts.SelectedValue));
                  ddlPoliceStations.DataBind();
                  ListItem list_2 = new ListItem("-Select-", "-1");
                  ddlPoliceStations.Items.Insert(0, list_2);
              }
          }
          catch (Exception) 
          {
  
          }
  
  
      }
  
      protected void ddlPoliceStations_SelectedIndexChanged(object sender, EventArgs e)
      {
          lblPriority.Visible = true;
          ddlPriority.Visible = true;
          ddlDistricts.Visible = true;
      }
  </code></pre>