Is it possible to access controls in the InsertItemTemplate of the GridTemplateColumn? I have the following:
<telerik:GridTemplateColumnUniqueName="Company"HeaderText="Company Name"> <ItemTemplate> <asp:LabelID="lblName"runat="server"Text='<%#Eval("Name")%>'></asp:Label> </ItemTemplate> <InsertItemTemplate> <telerik:RadAutoCompleteBoxrunat="server"ID="CompanyList"EmptyMessage="select company"></telerik:RadAutoCompleteBox> </InsertItemTemplate></telerik:GridTemplateColumn>In the code behind I have:
if(e.Item is GridEditableItem && e.Item.OwnerTableView.IsItemInserted){ GridEditableItem item = e.Item asGridEditableItem; RadAutoCompleteBox ab = item["Company"].FindControl("CompanyList") asRadAutoCompleteBox;}
I also tried:
if(e.Item is GridDataItem && e.Item.OwnerTableView.IsItemInserted){ GridDataItem item = e.Item asGridDataItem; RadAutoCompleteBox ab = item["Company"].FindControl("CompanyList") asRadAutoCompleteBox;}In both cases ab returns null. When I placed the control inside ItemTemplate, I get the control. I also tried using FindControl on e.Item and item itself and still get null. Basically I want to add a datasource to the autocomplete box only when inserting...on edit I only show the label. I want to bind the control using Telerik Data Access.