title: Using the value of a DropDownList in a GridView on inserting a new entry
body: <p>I searched for a few days now but didn't find a solution. So here is my scenario:</p>
  
  <p>I have a DetailView with a DataBindung to a database and DefaultMode set to "<em>Insert</em>" as a input-form for a new db-entry. One field in this DetailsView is a TemplateField with a InsertItemTemplate containing a DropDownList. This DropDownList is also bounded to another SqlDataSource, using a select-parameter "UserID" to get all rows of a database for the actual logged-in user. Those rows are shown in my DropDownList and when looking at the sourcecode in my browser I see the correct "option"-attributes with all those nice db-IDs in their corresponding value. So everything is fine to this point.</p>
  
  <p>Now I press my Insert-Button to send my data back to the server. But when trying to get the selected value from my DropDownList in DetailsView1_ItemInserting() with the following code I get a null-value.</p>
  
  <pre><code>var list = (DropDownList)DetailsView1.Rows[0].FindControl( "DropDownList1" );
  InsertEntryDataSource.InsertParameters["DropDownList1Value"].DefaultValue = list.Items[list.SelectedIndex].Value;
  </code></pre>
  
  <p>The same code works with another form I created in this project. The only difference is, that the other DropDownList is bounded to a DataSource without a select-parameter I have to set on runtime (the current logged-in UserID). </p>
  
  <p>My resumption was that the DropDownList is empty after the postback because the databinding wasn't yet done. So I set the select-parameter for the SqlDataSource my DropDownList is bounded to in DetailsView1_ItemInserting() - and now the above line got my value.</p>
  
  <p><strong>BUT</strong>: I just tested the form another time and I determined, that no matter which entry I select in my DropDownList, I get <strong>always</strong> the value of the <strong>first</strong> entry! The whole procedure seems to clear my SelectedIndex of the DropDownList - so now I have a value to insert instead of null, but it's the wrong one. :-(</p>
  
  <p>So my question: How can I access the selected value of my DropDownList in DetailsView1_ItemInserting() to save it to the database?</p>
  
  <p>Thanks in advance,
  Anheledir</p>