I have a Grid (SubGrid1) within a Grid (RadGrid1).
When I edit SubGrid1 I need to load values for a RadComboBox.
I'm currently loading values for RadGrid1 without problems through the RadGrid_ItemDataBound event:
When I try to do the same for SubGrid1 I came to find out that the SubGrid1_ItemDataBound event is not being called upon selecting "Edit" on this grid.
When I edit SubGrid1 I need to load values for a RadComboBox.
I'm currently loading values for RadGrid1 without problems through the RadGrid_ItemDataBound event:
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode)) |
| { |
| //Loading RadComboBoxes here without problems |
| //... |
| } |
| //... |
| } |
When I try to do the same for SubGrid1 I came to find out that the SubGrid1_ItemDataBound event is not being called upon selecting "Edit" on this grid.
| <telerik:RadGrid ID="SubGrid1" runat="server" AllowSorting="False" GridLines="None" |
| Style="margin-left: 0px" AutoGenerateColumns="False" Width="95%" OnItemDataBound="SubGrid1_ItemDataBound" OnItemCommand="SubGrid1_ItemCommand" |
| OnItemDeleted="SubGrid1_ItemDeleted" OnItemCreated="SubGrid1_ItemCreated" |
| OnItemInserted="SubGrid1_ItemInserted" OnItemUpdated="SubGrid1_ItemUpdated"> |
| <HeaderContextMenu EnableTheming="True"> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </HeaderContextMenu> |
| <MasterTableView EditMode="InPlace" CommandItemSettings-AddNewRecordText="Add New Phone Number" |
| CommandItemDisplay="Top"> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridEditCommandColumn HeaderStyle-Width="20px" EditText="Edit"> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </telerik:GridEditCommandColumn> |
| <telerik:GridMaskedColumn Mask="(###) ###-####" |
| UniqueName="Phone" HeaderText="Phone#" DataField="Phone"> |
| <HeaderStyle Width="120px" /> |
| </telerik:GridMaskedColumn> |
| <telerik:GridTemplateColumn HeaderStyle-Width="20px" UniqueName="colPhoneType"> |
| <EditItemTemplate> |
| <telerik:RadComboBox ID="PhoneType" runat="server"> |
| </telerik:RadComboBox> |
| </EditItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridTemplateColumn HeaderStyle-Width="20px" UniqueName="DeletePhoneColumn"> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| <ItemTemplate> |
| <asp:ImageButton ID="imgbtnDelete" ToolTip="Delete Contact" runat="server" CommandName="Delete" ImageUrl="~/App_ThemesCustom/Pro1/images/recycle-bin-icon.gif" |
| OnClientClick="javascript:if(!confirm('This action will delete the selected contact. Are you sure?')){return false;}" /> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| </Columns> |
| <EditFormSettings EditFormType="Template"> |
| <FormStyle /> |
| <FormTemplate> |
| <asp:Table runat="server" ID="Table1" CellSpacing="1" CellPadding="1" Width="250" |
| border="0"> |
| <asp:TableRow> |
| <asp:TableCell></asp:TableCell> |
| <asp:TableCell></asp:TableCell> |
| </asp:TableRow> |
| <asp:TableRow> |
| <asp:TableCell> |
| Phone Number: |
| </asp:TableCell> |
| <asp:TableCell> |
| <telerik:RadTextBox ID="PhoneEdit" Text='<%# Bind( "Phone") %>' runat="server"> |
| </telerik:RadTextBox> |
| <cc1:MaskedEditExtender ID="MaskPhoneEdit" runat="server" TargetControlID="PhoneEdit" MaskType="Number" Mask="(999) 999-9999" ClearMaskOnLostFocus="false"> |
| </cc1:MaskedEditExtender> |
| </asp:TableCell> |
| </asp:TableRow> |
| <asp:TableRow> |
| <asp:TableCell> |
| Phone Type: |
| </asp:TableCell> |
| <asp:TableCell ID="tblClPhoneType" runat="server" Wrap="False"> |
| <telerik:RadComboBox Width="150px" ID="RadComboPhoneType" runat="server"> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </telerik:RadComboBox> |
| </asp:TableCell> |
| </asp:TableRow> |
| </asp:Table> |
| <asp:Table runat="server" Style="width: 95%"> |
| <asp:TableRow> |
| <asp:TableCell Style="text-align: right;" ColumnSpan="2"> |
| <asp:Button ID="Button1" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' |
| runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'> |
| </asp:Button> |
| <asp:Button ID="Button2" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"> |
| </asp:Button> |
| </asp:TableCell> |
| </asp:TableRow> |
| </asp:Table> |
| </FormTemplate> |
| </EditFormSettings> |
| <NoRecordsTemplate> |
| No Records Found |
| </NoRecordsTemplate> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| </MasterTableView> |
| <ClientSettings AllowColumnsReorder="True" AllowRowsDragDrop="True" ReorderColumnsOnClient="True"> |
| <Selecting AllowRowSelect="True" /> |
| </ClientSettings> |
| <FilterMenu EnableTheming="True"> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </FilterMenu> |
| </telerik:RadGrid> |
| protected void RadGridPhones_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| //This event is not firing. |
| } |
Can anybody see anything wrong with how I do it? I don't use DataSourceID, but there has got to be a way to get it to work this way too.
The only difference between RadGrid1 and SubGrid1 is that I do an InPlace edit on SubGrid1.
Thanks.