Is it possible to access controls in the InsertItemTemplate of the GridTemplateColumn? I have the following:
<telerik:GridTemplateColumn UniqueName="Company" HeaderText="Company Name"> <ItemTemplate> <asp:Label ID="lblName" runat="server" Text='<%#Eval("Name")%>'></asp:Label> </ItemTemplate> <InsertItemTemplate> <telerik:RadAutoCompleteBox runat="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 as GridEditableItem; RadAutoCompleteBox ab = item["Company"].FindControl("CompanyList") as RadAutoCompleteBox;}I also tried:
if (e.Item is GridDataItem && e.Item.OwnerTableView.IsItemInserted){ GridDataItem item = e.Item as GridDataItem; RadAutoCompleteBox ab = item["Company"].FindControl("CompanyList") as RadAutoCompleteBox;}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.
