GridView take a Row
<p>net 4 and c#.</p>

<p>I have a GridView, I would like take a Row when in Edit Mode in my code and find a control.</p>

<p>Here my code, but does not work, it takes only the first row for the GridView.</p>

<p>Any ideas?</p>

<pre><code>protected void uxManageSlotsDisplayer_RowDataBound(object sender, GridViewRowEventArgs e)
{

    switch (e.Row.RowType)
    {
        case DataControlRowType.DataRow:

        // Take Row in Edit Mode DOES NOT WORK PROEPRLY
        if (e.RowState == DataControlRowState.Edit)
        {
            Label myTest = (Label)e.Row.FindControl("uxTest");
        }
        break;

    }
</code></pre>

<p>MY CODE EXAMPLES:
<a href="http://stackoverflow.com/questions/5170261/gridview-row-in-edit-mode">GridView row in edit mode</a></p>

<p>SOLUTIONS:
After reading this: <a href="http://stackoverflow.com/questions/833490/asp-net-3-5-gridview-row-editing-dynamic-binding-to-a-dropdownlist">ASP.NET 3.5 GridView - row editing - dynamic binding to a DropDownList</a></p>

<pre><code>        protected void uxList_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow &amp;&amp;
                (e.Row.RowState &amp; DataControlRowState.Edit) == DataControlRowState.Edit)
        {
            // Here you will get the Control you need like:
            Label dl = (Label)e.Row.FindControl("uxLblTest");
            dl.Text = "xxxxxxxxxxxxx";
        }
    }
</code></pre>
