title: How to filter the data in an SQL DDL based on another DDL?
body: <p>I am trying to make a simple ASP.NET C# application that will provide the user with two DDLs. The first one is pre-populated with customers from an SQL database, and when a customer is selected, the second will then populate with that customer's orders.</p>
  
  <p>I am using SqlDataSources for this, the first DDL lists without issue, and displays customer names alphabetically, along with assigning the CustomerID as the value. How could I go about using code to dynamically adjust the WHERE clause of the second DDL to dynamically match the value of the first DDL?</p>
  
  <p>To exemplify, my second dropdown would (ideally) have a SELECT statement similar to the following:</p>
  
  <pre><code>SELECT [OrderID], [CustomerID] FROM [Orders] WHERE [CustomerID] = ddl1.SelectedValue
  </code></pre>
  
  <p>Unfortunately, and naturally, this throws an error, but should illustrate what I am trying to accomplish.</p>
  
  <p>Making it dynamically update from this point would be easy, but I am not certain how to filter results based on an outside source.</p>
  
  <p>Any help would be appreciated!</p>