How to acess ID from EditItemTemplate inside Gridview
<p>I have a WebForms GridView, where I want to update a BoundField conditionally (or I use a value from a DropDown or I use the text from a Textbox), based on the value from another DropDownList.</p>

<pre><code>&lt;asp:GridView ID="gv_results" runat="server" DataKeyNames="ID_RESULTS" DataSourceID="get_results"&gt;
            &lt;Columns&gt;
              &lt;asp:TemplateField HeaderText="DETAIL" SortExpression="DETAIL"&gt;
                    &lt;EditItemTemplate&gt;
                        &lt;asp:TextBox ID="tb_detail_edit" runat="server"&gt;&lt;/asp:TextBox&gt;
                        &lt;asp:DropDownList ID="dd_detail_edit" runat="server" AutoPostBack="True" DataSourceID="get_detail" DataTextField="DETAIL" DataValueField="DETAIL" &gt;&lt;/asp:DropDownList&gt;
                        &lt;/asp:SqlDataSource&gt;
                    &lt;/EditItemTemplate&gt;
                    &lt;ItemTemplate&gt;

        &lt;asp:SqlDataSource runat="server" ID="get_results" 
            UpdateCommand="UPDATE RESULTS SET [DETAIL] = COALESCE(@DETAIL,@DETAILwelcome)"&gt;
            &lt;UpdateParameters&gt;
                &lt;asp:ControlParameter ControlID="ctl00$MainContent$gv_results$ctl02$dd_detail_edit" PropertyName="SelectedValue" Name="DETAIL" Type="String"&gt;&lt;/asp:ControlParameter&gt;
                &lt;asp:ControlParameter ControlID="ctl00$MainContent$gv_results$ctl02$tb_detail_edit" PropertyName="Text"  Name="DETAILwelcome" Type="String"&gt;&lt;/asp:ControlParameter&gt;
            &lt;/UpdateParameters&gt;
        &lt;/asp:SqlDataSource&gt;
</code></pre>

<p>Well, I found out in the google's that I have to use the Direct ID in the Control Parameter. And it works...the thing is , the $ctl02 (for example) before the id of the dd_detail_edit, changes, with different rows in the Gridview (so this id works for one row, but maybe for the next it doesn't work.</p>

<p>Is there some workaround for this?</p>

<p>Using only something like $gv_results$dd_detail_edit , doesn't work, I dunno why :S</p>

<p>TIA and Best Regards,</p>