title: Why won't my ListView SelectedItemTemplate show when selected?
body: <p>I have a databound ListView in asp.Net.  I have both ItemTemplate and SelectedItemTemplate used in the aspx page.</p>
  
  <p>In the .cs page I have this.  I have verified by stepping through the code that the if statement evaluates to true only when it is supposed to, and that the selected index is set.  However the HTML output is as if all items use the ItemTemplate.</p>
  
  <pre><code>    int indexCounter = 0;
      protected void lvProducts_ItemDataBound(object sender, ListViewItemEventArgs e)
      {
          if (e.Item.ItemType == ListViewItemType.DataItem)
          {
              if (((DataRowView)e.Item.DataItem)["ID"].ToString() == Request.QueryString["id"])
              {
                  lvProducts.SelectedIndex = indexCounter;
              }
              indexCounter++;
          }
      }
  </code></pre>
  
  <p>Is there a better way to do this?</p>