title: how to show selected text in a dropdownlist?
body: <p>I have a static drop-down list control in asp.net page and I have two different string (based on a result which I am fetching through database) now I want to make selected text of the the current input and the indexing and values remains same.</p>
  
  <pre><code>&lt;asp:DropDownList ID="ddl_room_type" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddl_room_type_SelectedIndexChanged"&gt;
  &lt;asp:ListItem Selected="True"&gt;Select Type&lt;/asp:ListItem&gt;
  &lt;asp:ListItem Text="Deluxe" Value="2500"&gt;&lt;/asp:ListItem&gt;
  &lt;asp:ListItem Text="Super Deluxe" Value="3000"&gt;&lt;/asp:ListItem&gt;
  &lt;asp:ListItem Text="Luxury" Value="5000"&gt;&lt;/asp:ListItem&gt;
  &lt;asp:ListItem Text="Special Room" Value="10000"&gt;&lt;/asp:ListItem&gt;
  &lt;/asp:DropDownList&gt;
  </code></pre>
  
  <p>and I have a string Text from Database : lets say Special Room. Now I want that drop-down list i.e, ddl_room_type should automatically bind with the same text and value.</p>
  
  <p>C# Code which I am using: </p>
  
  <pre><code>string luxury = "Special Room"; //Value coming form Database
  ddl_room_type.SelectedItem.Text = luxury;
  </code></pre>
  
  <p>If I do with this code.. it is just selected the first text as : "Special Room"</p>