title: Cannot set the selectedindexchange of two dropdownlist in gridview
body: <p>I have three dropdownlist in gridview's template field. If the first dropdownlist has selected value in it then i am populating the other two dropdownlist with an array of listitem. Both the dropdownlist will have same items in them.</p>
  
  <p>Suppose I have dropdown named ddlone, ddltwo, ddlthree. If ddlone has a selectedvalue then according to the selectedvalue of ddlone I am adding items in ddltwo and dllthree. They both have same list of items. The problem is when I set the selectedindex or selectedvalue of either ddltwo or ddlthree then both get the same index or values I don't know how.</p>
  
  <p>Here is my gridview:</p>
  
  <pre><code>&lt;asp:GridView ID="GridView1" runat="server" 
  AutoGenerateColumns="false" OnRowDataBound="gridview_RowDataBound"&gt;
  &lt;HeaderStyle HorizontalAlign="Left" /&gt;
  &lt;Columns&gt;
      &lt;asp:BoundField HeaderText="SrNo" DataField="SrNo" /&gt;
      &lt;asp:TemplateField HeaderText="ONE"&gt;
          &lt;ItemTemplate&gt;
              &lt;asp:DropDownList ID="ddlone" runat="server" AutoPostBack="True"
              OnSelectedIndexChanged="ddlone_SelectedIndexChanged"&gt;
              &lt;/asp:DropDownList&gt;
          &lt;/ItemTemplate&gt;
      &lt;/asp:TemplateField&gt;
      &lt;asp:TemplateField HeaderText="Two"&gt;
          &lt;ItemTemplate&gt;
              &lt;asp:DropDownList ID="ddltwo" runat="server"&gt;
              &lt;/asp:DropDownList&gt;
          &lt;/ItemTemplate&gt;
      &lt;/asp:TemplateField&gt;
      &lt;asp:TemplateField HeaderText="Three"&gt;
          &lt;ItemTemplate&gt;
              &lt;asp:DropDownList ID="ddlthree" runat="server"&gt;
              &lt;/asp:DropDownList&gt;
          &lt;/ItemTemplate&gt;
      &lt;/asp:TemplateField&gt;
      &lt;asp:TemplateField HeaderText="Add"&gt;
          &lt;ItemTemplate&gt;
              &lt;asp:LinkButton ID="lnkAddon" runat="server" Text="+" 
                Font-Underline="false"&gt;
              &lt;/asp:LinkButton&gt;
          &lt;/ItemTemplate&gt;
      &lt;/asp:TemplateField&gt;
  &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>All this is being done in gridview_rowdatabound event here is my code:</p>
  
  <pre><code>ddlone.SelectedValue = value_one;
  items = GetItems(value_one);
  ddltwo.Items.Clear(); ddlthree.Items.Clear();
  foreach (ListItem it in items)
  {
      ddlopen.Items.Add(it); ddlclose.Items.Add(it);
  }
  if (!string.IsNullOrEmpty(value_two)) ddltwo.SelectedValue = value_two;
  if (!string.IsNullOrEmpty(value_three)) ddlthree.SelectedValue = value_three;
  </code></pre>
  
  <p>When the second last statement is executed the value of ddltwo and ddlthree becomes same. When the last statement is executed the selecetedvalue of ddltwo and ddlthree becomes same.</p>
  
  <p>I tried making a copy of items but still the problem persists.</p>