title: DropDownList selected value issue
body: <p>The below code gets selected value from a grid-view row to DropDownList with id <code>dllinvoivceid</code> </p>
  
  <pre><code>protected void gridvoucher_RowCommand(object sender, GridViewCommandEventArgs e)
  {
  try
  {
  string commandName = e.CommandName.ToString().Trim();
  GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);             
  string custid = row.Cells[5].Text;
  string invoiceid = row.Cells[4].Text;
  GridViewRow gvRow = (GridViewRow)((Control)e.CommandSource).NamingContainer;
  Int32 rowind = gvRow.RowIndex;
  switch (commandName)
  {
  case "EditVoucher":
  dllcust.SelectedValue = custid;
  dllinvoivceid.SelectedValue = invoiceid;                       
  MultiView1.ActiveViewIndex = 1;
  break;                   
  }
  }
  catch (Exception ex)
  {
  Response.Write("Error: " + ex.Message);
  }
  }
  </code></pre>
  
  <p>as you can see from below code i put constrain for <code>dllinvoivceid</code> based on <code>dllcust</code>to get invoices for only the selected customer  the issue is the selected value i get for <code>dllinvoivceid</code> is the first result from the select command in <code>dllinvoivceid</code> not the value from the grid view</p>
  
  <pre><code>&lt;div class="form-group"&gt;
  &lt;label for="InputName"&gt;
  Customer Name&lt;/label&gt;
  &lt;div class="form-group"&gt;
  &lt;asp:DropDownList ID="dllcust" CssClass="form-control chosen-select" runat="server" AutoPostBack="True" DataSourceID="Sqls_Cust" DataTextField="Cust_Name" DataValueField="Cust_ID"&gt;&lt;/asp:DropDownList&gt;
  &lt;asp:SqlDataSource ID="Sqls_Cust" runat="server" ConnectionString="&lt;%$ ConnectionStrings:ConnString %&gt;" SelectCommand="SELECT [Cust_ID], [Cust_Name] FROM [Customer]"&gt;&lt;/asp:SqlDataSource&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
  &lt;label for="InputName"&gt;
  Invoice ID&lt;/label&gt;
  &lt;div class="form-group"&gt;
  &lt;asp:DropDownList ID="dllinvoivceid" CssClass="form-control chosen-select" runat="server" AutoPostBack="True" DataSourceID="Sqlds_Invoive" DataTextField="InvoiceID" DataValueField="InvoiceID"&gt;&lt;/asp:DropDownList&gt;
  &lt;asp:SqlDataSource ID="Sqlds_Invoive" runat="server" ConnectionString="&lt;%$ ConnectionStrings:ConnString %&gt;" SelectCommand="SELECT Invoice.InvoiceID FROM Customer INNER JOIN Invoice ON Customer.Cust_ID = Invoice.Cust_ID WHERE (Customer.Cust_ID = @Cust_ID)"&gt;
  &lt;SelectParameters&gt;
  &lt;asp:ControlParameter ControlID="dllcust" Name="Cust_ID" PropertyName="SelectedValue" /&gt;
  &lt;/SelectParameters&gt;
  &lt;/asp:SqlDataSource&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>