Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1705
Find control in a templated column
posted

Hey guys, 

 

I read somewhere that templated columns cannot be edited, so I dropped a textbox and a linkbutton right in the templated column in order to update the field:

<ig:TemplateDataField Key="URL" Header-Text="URL" >            

    <ItemTemplate >

        <a runat="server" id="URLLink" href='<%# Eval("URL")%>' >Link</a>

        <br />

        <asp:TextBox runat="server" ID="txtBxURL"></asp:TextBox> <asp:LinkButton runat="server" ID="lnkBttnChangeURL" Text="Update" CommandName="ChangeURL" CommandArgument='<%# Eval("RowID")%>'/>                    

    </ItemTemplate>                                               

</ig:TemplateDataField>

The problem is I can't find a way to get a reference to the TextBox control. I tried the following line of code within the OnItemCommand event (fired by the link button):

((TemplateDataField)this.WbDtGrdAppVersion.Columns["URL"]).ItemTemplate

but ItemTemplate doesn't seem to have a FindControl or some sort of collection of controls.

Any help would be appreciated.

 

Thanks !