ASP.NET - Template Field Drop Down List
<p>Please see the code below:</p>

<pre><code>Protected Sub GVHistoricNames_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GVHistoricNames.RowUpdating
            Try
                'Dim strUsercode As String = GVHistoricNames.Rows(e.RowIndex).Cells(2).Text
                Dim ddl As DropDownList = CType(GVHistoricNames.Rows(e.RowIndex).FindControl("ddlUsercode"), DropDownList)
                MsgBox(ddl.SelectedIndex)


            Catch ex As Exception
                 'I don't swallow exceptions
            Finally

            End Try
        End Sub
</code></pre>

<p>I am trying to get the selected value of a drop down list.  The template field is defined like this:</p>

<pre><code>&lt;asp:TemplateField HeaderText="Usercode"&gt;
                 &lt;ItemTemplate&gt;
                &lt;asp:DropDownList ID="ddlUsercode" runat="server" SelectedValue ='&lt;%# Bind("Usercode") %&gt;' DataTextField="Usercode" DataValueField="Usercode"&gt;
                &lt;/asp:DropDownList&gt; 
                &lt;/ItemTemplate&gt;
            &lt;/asp:TemplateField&gt;
</code></pre>

<p>MsgBox(ddl.SelectedIndex) always prints an empty String in: GVHistoricNames_RowUpdatinGVHistoricNames_RowUpdating.  What am I doing worng?</p>
