title: Problems in DropDownList with updatepanel
body: <p>I have two DropDownList with update panel when i select value from first dropdownlist then in second dropdownlist display data related first. But there is problem at run time it can't display dropdownlist and continuously refresh this page.</p>
  
  <p>So please help to solve this problem.</p>
  
  <p>Here is my code ASPX PAGE</p>
  
  <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddRoomPrice.aspx.cs" Inherits="AddRoomPrice" %&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" /&gt;
      &lt;title&gt;Presha Admin&lt;/title&gt;
      &lt;style type="text/css"&gt;
          @import url("css/style.css");
          @import url('css/style_text.css');
          @import url('css/form-buttons.css');
          @import url('css/link-buttons.css');
          @import url('css/menu.css');
          @import url('css/statics.css');
          @import url('css/messages.css');
          @import url('css/table-sorter.css');
          @import url('css/tabs.css');
          @import url('css/forms.css');
          @import url('css/datepicker.css');
          @import url('css/jquery.fancybox-1.3.4.css');
          @import url('css/accordions.css');
          @import url('css/jquery.treeview.css');
          @import url('css/wysiwyg.css');
          @import url('css/wysiwyg.modal.css');
          @import url('css/wysiwyg-editor.css');
      &lt;/style&gt;
  
      &lt;script type="text/javascript" src="js/jquery-1.6.2.min.js"&gt;&lt;/script&gt;
  
      &lt;link rel="shortcut icon" href="gfx/Favicon.png"&gt;
  
      &lt;link rel="stylesheet" type="text/css" href="css/component.css" /&gt;
      &lt;script type="text/javascript" src="js/modernizr.custom.js"&gt;&lt;/script&gt;
  
      &lt;!--[if lte IE 8]&gt;
          &lt;script type="text/javascript" src="js/excanvas.min.js"&gt;&lt;/script&gt;
      &lt;![endif]--&gt;
  
  
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form id="form1" runat="server"&gt;
  &lt;asp:ScriptManager ID="ScriptManager1" runat="server"&gt;
  &lt;/asp:ScriptManager&gt;
      &lt;div class="container"&gt;
          &lt;div class="logo-labels"&gt;
              &lt;a href="Default.aspx"&gt;&lt;img id="logo" runat="server" src="~/gfx/logo.png" height="50" /&gt;&lt;/a&gt;
              &lt;ul&gt;
                  &lt;li&gt;&lt;asp:Label ID="lblAdmin" runat="server" Text="Wel come "&gt;&lt;/asp:Label&gt;&lt;/li&gt;
                  &lt;li class="logout"&gt;&lt;asp:LinkButton ID="lnkLogout" runat="server" onclick="lnkLogout_Click"&gt;&lt;span&gt;Logout&lt;/span&gt;&lt;/asp:LinkButton&gt;&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/div&gt;
          &lt;div class="menu-search"&gt;
              &lt;ul&gt;
                  &lt;li&gt;&lt;a href="Default.aspx"&gt;Home&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="#"&gt;Hotel&lt;/a&gt;
                      &lt;ul&gt;
                          &lt;li&gt;&lt;a href="HotelList.aspx"&gt;Hotel List&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="AddHotel.aspx"&gt;Add Hotel&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/li&gt;
                  &lt;li&gt;&lt;a href="#"&gt;Hotel Album&lt;/a&gt;
                      &lt;ul&gt;
                          &lt;li&gt;&lt;a href="HotelAlbumList.aspx"&gt;Album List&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="AddHotelAlbum.aspx"&gt;Add Album&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/li&gt;
                  &lt;li&gt;&lt;a href="#"&gt;Hotel Facility&lt;/a&gt;
                      &lt;ul&gt;
                          &lt;li&gt;&lt;a href="HotelFacilityList.aspx"&gt;Facility List&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="AddHotelFacility.aspx"&gt;Add Facility&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/li&gt;
                  &lt;li&gt;&lt;a href="#"&gt;Category&lt;/a&gt;
                      &lt;ul&gt;
                          &lt;li&gt;&lt;a href="RoomCategoryList.aspx"&gt;Category List&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="AddRoomCategory.aspx"&gt;Add Category&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/li&gt;
                  &lt;li class="current"&gt;&lt;a href="#"&gt;Room Price&lt;/a&gt;
                      &lt;ul&gt;
                          &lt;li&gt;&lt;a href="RoomPriceList.aspx"&gt;Price List&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="AddRoomPrice.aspx"&gt;Add Price&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/li&gt;
                  &lt;li&gt;&lt;a href="AddFacility.aspx"&gt;New Facility&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="#"&gt;Admin&lt;/a&gt;
                      &lt;ul&gt;
                          &lt;li&gt;&lt;a href="AdminList.aspx"&gt;Admin List&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="AddAdmin.aspx"&gt;Add Admin&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/li&gt;
                  &lt;li&gt;&lt;a href="Inquiry.aspx"&gt;Inquiry&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="GetLatitudeLongitude.aspx" target="_blank"&gt;Map&lt;/a&gt;&lt;/li&gt;
  
              &lt;/ul&gt;
          &lt;/div&gt;
          &lt;div class="breadcrumbs"&gt;
              &lt;ul&gt;
                  &lt;li class="home"&gt;&lt;a href="Default.aspx"&gt;&lt;/a&gt;&lt;/li&gt;
                  &lt;li class="break"&gt;&amp;#187;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="AddRoomPrice.aspx"&gt;Add Room Price&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/div&gt;
          &lt;div class="section"&gt;
              &lt;div class="box"&gt;
                  &lt;div class="title"&gt;
                      &lt;h2&gt;Add/Edit Room Category&lt;/h2&gt;
                  &lt;/div&gt;
  
                  &lt;div class="content forms"&gt;
                      &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt;
                          &lt;ContentTemplate&gt;
                              &lt;div class="line padding-left50"&gt;
                                  &lt;label&gt;Hotel&lt;/label&gt;
                                  &lt;asp:DropDownList ID="ddlHotel" runat="server" AutoPostBack="true"
                                      onselectedindexchanged="ddlHotel_SelectedIndexChanged"&gt;
                                  &lt;/asp:DropDownList&gt;
                              &lt;/div&gt;
                          &lt;/ContentTemplate&gt;
                          &lt;Triggers&gt;
                              &lt;asp:AsyncPostBackTrigger ControlID="ddlHotel" EventName="selectedindexchanged" /&gt;
                          &lt;/Triggers&gt;
                      &lt;/asp:UpdatePanel&gt;
  
                      &lt;asp:UpdatePanel ID="UpdatePanel2" runat="server"&gt;
                          &lt;ContentTemplate&gt;
                              &lt;div class="line padding-left50"&gt;
                                  &lt;label&gt;Room Category&lt;/label&gt;
                                  &lt;asp:DropDownList ID="ddlCategory" runat="server"&gt;
                                  &lt;/asp:DropDownList&gt;
                              &lt;/div&gt;
                          &lt;/ContentTemplate&gt;
                          &lt;Triggers&gt;
                              &lt;asp:AsyncPostBackTrigger ControlID="ddlHotel" EventName="selectedindexchanged" /&gt;
                          &lt;/Triggers&gt;
                      &lt;/asp:UpdatePanel&gt;
                      &lt;div class="line padding-left50"&gt;
                          &lt;label&gt;Single Price&lt;/label&gt;
                          &lt;asp:TextBox ID="txtSingle" runat="server" class="medium"&gt;&lt;/asp:TextBox&gt;
                      &lt;/div&gt;
                      &lt;div class="line padding-left50"&gt;
                          &lt;label&gt;Double Price&lt;/label&gt;
                          &lt;asp:TextBox ID="txtDouble" runat="server" class="medium"&gt;&lt;/asp:TextBox&gt;
                      &lt;/div&gt;
                      &lt;div class="line padding-left50"&gt;
                          &lt;label&gt;Extra Bed Price&lt;/label&gt;
                          &lt;asp:TextBox ID="txtExtraBed" runat="server" class="medium"&gt;&lt;/asp:TextBox&gt;
                      &lt;/div&gt;
                      &lt;div class="line padding-left50"&gt;
                          &lt;label&gt;Meal Plan&lt;/label&gt;
                          &lt;asp:TextBox ID="txtMealPlan" runat="server" class="medium"&gt;&lt;/asp:TextBox&gt;
                      &lt;/div&gt;
                      &lt;div class="line padding-left50"&gt;
                          &lt;label&gt;Extra Meal Price&lt;/label&gt;
                          &lt;asp:TextBox ID="txtExtraMeal" runat="server" class="medium"&gt;&lt;/asp:TextBox&gt;
                      &lt;/div&gt;
  
                      &lt;div class="line button" style="padding-left:325px"&gt;
                          &lt;asp:Button ID="btnSubmit" runat="server" Text="Sumbit" CssClass="btn btn-2 btn-2d" onclick="btnSubmit_Click"&gt;&lt;/asp:Button&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;script type="text/javascript" src="js/superfish.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/supersubs.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/hoverIntent.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/jquery.flot.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/jquery.graphtable-0.2.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/jquery-ui.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/customInput.jquery.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/jquery.tablesorter.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/jquery.tablesorter.pager.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/jquery.sparkbox-select.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/jquery.fancybox-1.3.4.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/jquery.filestyle.mini.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/date.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/jquery.datepicker.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/jquery.treeview.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/jquery.tipsy.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/jquery.wysiwyg.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/plugins/wysiwyg.rmFormat.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/controls/wysiwyg.image.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/controls/wysiwyg.link.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/controls/wysiwyg.table.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/inline.js"&gt;&lt;/script&gt;
  
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and here is CS code</p>
  
  <pre><code>using System;
  using System.Collections;
  using System.Configuration;
  using System.Data;
  using System.Linq;
  using System.Web;
  using System.Web.Security;
  using System.Web.UI;
  using System.Web.UI.HtmlControls;
  using System.Web.UI.WebControls;
  using System.Web.UI.WebControls.WebParts;
  using System.Xml.Linq;
  using BLL;
  
  public partial class AddRoomPrice : System.Web.UI.Page
  {
      clsbll bll = new clsbll();
  
      protected void Page_Load(object sender, EventArgs e)
      {
          if (Session["admin"] != null)
          {
              lblAdmin.Text = "Wel Come " + Session["admin"].ToString();
          }
          else
          {
              Response.Redirect("Login.aspx");
          }
  
          if (!Page.IsPostBack)
          {
              if (Session["hotelID"] != null)
              {
                  ddlHotel.SelectedValue = Session["hotelID"].ToString();
              }
              ddlHotel.DataSource = bll.getHotel();
              ddlHotel.DataTextField = "HName";
              ddlHotel.DataValueField = "HotelID";
              ddlHotel.DataBind();
              ddlHotel.Items.Insert(0, "Select Hotel");
          }
      }
      protected void btnSubmit_Click(object sender, EventArgs e)
      {
          bll.insertRoomPrice(txtSingle.Text, txtDouble.Text, txtExtraBed.Text, txtMealPlan.Text, txtExtraMeal.Text, Convert.ToInt32(ddlCategory.SelectedValue), Convert.ToInt32(ddlHotel.SelectedValue));
  
          txtSingle.Text = "";
          txtDouble.Text = "";
          txtExtraBed.Text = "";
          txtMealPlan.Text = "";
          txtExtraMeal.Text = "";
          ddlCategory.SelectedIndex = 0;
          ddlHotel.SelectedIndex = 0;
          Session.Remove("hotelID");
          //Session.Remove("hotel");
      }
      protected void ddlHotel_SelectedIndexChanged(object sender, EventArgs e)
      {
          ddlCategory.DataSource = bll.getCategoryByID(ddlHotel.SelectedValue);
          ddlCategory.DataTextField = "RCategoryNameBed";
          ddlCategory.DataValueField = "RCategoryID";
          ddlCategory.DataBind();
          ddlCategory.Items.Insert(0, "Select Category");
      }
  
      protected void lnkLogout_Click(object sender, EventArgs e)
      {
          Session.Remove("admin");
          Response.Redirect("Login.aspx");
      }
  }
  </code></pre>
  
  <p>So please reply as soon as possible</p>
  
  <p>Thanks</p>