title: Get selectedIndex from a dropdown list on submit
body: <p>This is my first web page ever and I can't seem to find the correct way to get the selected index from a dropdown list. I don't need the selected index until the user presses the submit button.  I've been testing everything I've found on the subject, but nothing is working.</p>
  
  <p>I don't want the drop-down box to reset when the selection is made, which is what happens if I use postback=true or any selected index changed events.  And, I still get an index of 0.</p>
  
  <p>When I test, the selected index is always zero.</p>
  
  <p>This runs on page load:</p>
  
  <pre><code> ddlBudgetLineItem.DataSource = budget.BudgetLineItems;
   ddlBudgetLineItem.DataTextField = "Name";
   ddlBudgetLineItem.DataValueField = "BudgetLineItemID";
   ddlBudgetLineItem.DataBind();
  </code></pre>
  
  <p>This is the drop-down list:</p>
  
  <pre><code>&lt;asp:DropDownList ID="ddlBudgetLineItem" runat="server"&gt;
              &lt;/asp:DropDownList&gt;
  </code></pre>
  
  <p>Here is the code that needs the index:</p>
  
  <pre><code>protected void submitPayment()
      {            
          string amountValue = txtAmount.Text.ToString();
  
          float amount = float.Parse(amountValue);
  
          Payment payment = new Payment()
          {
              Amount = amount,
              Payee = txtPayee.Text,
              BudgetLineItem = budget.BudgetLineItems[ddlBudgetLineItem.SelectedIndex],
              Memo = txtMemo.Text,
              PaymentDate = DateTime.Parse(txtPaymentDate.Text),
              ExtraUserInfo = info
          };
  
          provider.AddPayment(payment);
      }
  </code></pre>
  
  <p>Any assistance is appreciated.</p>