title: dropdown in a gridview header
body: <p>I have a wierd problem in my gridview. </p>
  
  <p>Here's the aspx page with a dropdown list in the header.</p>
  
  <pre><code>asp:TabContainer ID="TabContainerType" runat="server" 
          ActiveTabIndex="0"
          Height="626px" Width="1259px" &gt;
  
  &lt;asp:TabPanel ID="tpDisperseSchemes" runat="server" HeaderText="Types"&gt;
  
  
          &lt;ContentTemplate&gt;
          &lt;asp:UpdatePanel ID = "uplDisperseTypes" runat="server" &gt;
  &lt;table&gt;
      &lt;asp:GridView ID="gvType" runat="server" AllowPaging="True" 
       AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="Id,UserId" 
       Height="152px" ondatabound="gvType_DataBound" 
       OnRowDataBound= "gvType_OnRowDataBound" ShowHeaderWhenEmpty="true"
  
      OnPageIndexChanging="gvType_PageIndexChanging"  EmptyDataText = " No Record Found"
      PageSize="4" 
      &lt;asp:TemplateField SortExpression="Type"&gt;
         &lt;HeaderTemplate&gt;
            &lt;asp:DropDownList ID="ddlTypes" runat="server" 
            OnSelectedIndexChanged = "ddlTypes_SelectedIndexChanged" AutoPostBack="true"&gt;
                &lt;asp:ListItem Value="0"&gt; Please Select Type&lt;/asp:ListItem&gt;
                 &lt;asp:ListItem Value="1"&gt;Type1&lt;/asp:ListItem&gt;
                 &lt;asp:ListItem Value="2"&gt;Type2&lt;/asp:ListItem&gt;
                 &lt;asp:ListItem Value="3"&gt;Type3&lt;/asp:ListItem&gt;
                 &lt;asp:ListItem Value="4"&gt;Type4&lt;/asp:ListItem&gt;
                 &lt;asp:ListItem Value="5"&gt;Type5&lt;/asp:ListItem&gt;
                 &lt;asp:ListItem Value="6"&gt;Type5&lt;/asp:ListItem&gt;
                 &lt;asp:ListItem Value="7"&gt;Type7&lt;/asp:ListItem&gt;
  
            &lt;/asp:DropDownList&gt;
            &lt;/HeaderTemplate&gt;                            
       &lt;ItemTemplate&gt;
      &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# Bind(TypeId")%&gt;'&gt;&lt;/asp:Label&gt;
       &lt;/ItemTemplate&gt;                            
    &lt;/asp:TemplateField&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Now, when I select a scheme from the DropDown, it refreshes and fetches data in the grid--works fine.</p>
  
  <p>But, immediately after the data is displayed on the grid, the dropdown goes back to the first value "Please Select a Type" instead of remaining at its selection. </p>
  
  <p>Thank you for ur help
  Sun</p>