I´m having trouble grabbing RadComboBox when editing inline from a RadGrid. When I try to find the correct control through this GridEditableItem I always receive null. Can anyone throw me some pointers in how to access the RadCombobox from my code below?
My ascx.cs file:
<telerik:RadGrid runat="server" ID="grid_AccessRecords"
AllowPaging="True"
AllowSorting="True"
Visible="False"
Width="100%"
PageSize="25"
OnItemCommand="AccessRecordsGridOnItemCommand"
OnNeedDataSource="AccessRecordGridNeedDataSource">
<PagerStyle Position="TopAndBottom" />
<ClientSettings EnableRowHoverStyle="true" />
<MasterTableView DataKeyNames="Id" AutoGenerateColumns="False" EditMode="EditForms">
<Columns>
<telerik:GridTemplateColumn HeaderText="Eign" UniqueName="tmp_AccessGroup">
<ItemTemplate>
<asp:label runat="server" ID="lbl_accessGroupName" Text='<%# Eval("AccessGroupName") %>' />
</ItemTemplate>
<EditItemTemplate>
<telerik:RadComboBox runat="server" ID="combo_editAccessGroup"></telerik:RadComboBox>
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridEditCommandColumn UniqueName="EditCommandColumn" EditText="edit" ButtonType="ImageButton" EditImageUrl="/_layouts/images/AFLSharepoint2010/Edit.gif" />
<telerik:GridButtonColumn CommandName="Delete" Text="delete" ConfirmText="Are you sure?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete"
ButtonType="ImageButton" UniqueName="DeleteColumn" ImageUrl="/_layouts/images/AFLSharepoint2010/Delete.gif" />
</Columns>
<EditFormSettings ColumnNumber="1" CaptionDataField="Id" CaptionFormatString="derp">
EditColumn ButtonType="ImageButton" InsertText="Save" UpdateText="Save" UniqueName="EditCommandColumn" CancelText="Cancel" />
</EditFormSettings>
</MasterTableView>
</telerik:RadGrid>
The my cs file:
protected void AccessRecordsGridOnItemCommand(object sender, GridCommandEventArgs e)
{
GridEditableItem editableItem = e.Item as GridEditableItem;
if (editableItem != null)
{
RadComboBox comboEditAccessGroup = (RadComboBox) editableItem.FindControl("combo_editAccessGroup");
//TODO: find out why always null???
}
}