Hi, I'm having a problem with the RadGrid that has 2 levels of hierarchy, all bound in code behind (using NeedDataSource and DetailTableDataBind). Both levels have InPlace editing and the top level works correctly when I save it, it goes back into read-only mode using the RadGrid.MasterTableView.ClearEditItems() function. I try and do the same thing for the lower level one and whatever I do it stays in Edit Mode. I've tried the same as above, I've tried editItem.OwnerTableView.ClearEditItems() in the UpdateCommand function (which is where the top level table does it when it works). I have looked through forums trying different suggestions such as setting AllowAutomaticUpdates, Inserts etc. to false (though from what I understand that's the default value anyway).
The row even saves and everything it's just that it doesn't revert back to non-edit mode. I have noticed when I step through that the list of edit items in the child TableView stays at one item even after the ClearEditItems is called on it, while the MasterTableView seems to behave as expected when ClearEditItems is called on it. Could this be a limitation of Telerik or am I doing something wrong?
Here's my mark-up, can anyone see what I may have done to cause this?
The row even saves and everything it's just that it doesn't revert back to non-edit mode. I have noticed when I step through that the list of edit items in the child TableView stays at one item even after the ClearEditItems is called on it, while the MasterTableView seems to behave as expected when ClearEditItems is called on it. Could this be a limitation of Telerik or am I doing something wrong?
Here's my mark-up, can anyone see what I may have done to cause this?
<telerik:RadGrid ID="gvMain" runat="server" AutoGenerateColumns="false" Skin="Metro_JS" EnableEmbeddedSkins="false" AllowSorting="true" AllowAutomaticUpdates="false" AllowAutomaticInserts="false" AllowAutomaticDeletes="false"> <ClientSettings EnableRowHoverStyle="true" AllowKeyboardNavigation="true"> <ClientEvents OnKeyPress="GridKeyPress" OnCommand="onEditCommand" /> <KeyboardNavigationSettings AllowSubmitOnEnter="true" AllowActiveRowCycle="true" /> </ClientSettings> <MasterTableView EnableNoRecordsTemplate="true" DataKeyNames="ID" AllowCustomSorting="true" EditMode="InPlace" Name="Discount"> <HeaderStyle CssClass="StandardText" /> <ItemStyle CssClass="Clickable" /> <AlternatingItemStyle CssClass="Clickable" /> <NoRecordsTemplate> <asp:Panel ID='pnlEmpty' runat='server' style='position: relative; width: 100%; height: 30px;'> <asp:Label ID='lblEmpty' runat='server' Text='No Results Found' style='font-weight: bold; position: absolute; top: 10px; left: 10px;' CssClass='StandardText' /> </asp:Panel> </NoRecordsTemplate> <Columns> <telerik:GridBoundColumn DataField="Name" HeaderText="Name" UniqueName="DiscountName" MaxLength="100" ItemStyle-Width="600px"></telerik:GridBoundColumn> <telerik:GridTemplateColumn HeaderText="Start Date" ItemStyle-Width="160px"> <ItemTemplate> <asp:Label ID='lblStartDate' runat='server' Text='' CssClass='StandardText' /> </ItemTemplate> <EditItemTemplate> <telerik:RadDatePicker ID="rdpStartDate" runat="server" Width="150px"> </telerik:RadDatePicker> <asp:RequiredFieldValidator ID="valAmount" ControlToValidate="rdpStartDate" runat="server" Text="*" SetFocusOnError="True" Display="Dynamic" EnableViewState="true" ErrorMessage="Please enter a start date"></asp:RequiredFieldValidator> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="End Date" ItemStyle-Width="160px"> <ItemTemplate> <asp:Label ID='lblFinishDate' runat='server' Text='' CssClass='StandardText' /> </ItemTemplate> <EditItemTemplate> <telerik:RadDatePicker ID="rdpFinishDate" runat="server" Width="150px"> </telerik:RadDatePicker> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" ItemStyle-CssClass="EditColumn" UpdateImageUrl="../Images/tick-icon.png" CancelImageUrl="../Images/arrow-undo-icon.png" InsertImageUrl="../Images/tick-icon.png" /> <telerik:GridTemplateColumn ItemStyle-CssClass="DeleteColumn" UniqueName="DeleteColumn"> <ItemTemplate> <asp:ImageButton ID="imgDelete" runat="server" ImageUrl="~/Images/cross.png" CommandName="Delete" ToolTip="Delete" OnClientClick="return confirm('Are you sure you want to delete this Discount?');" CommandArgument='<%# Eval("ID") %>' /> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> <DetailTables> <telerik:GridTableView AllowAutomaticUpdates="false" AllowAutomaticInserts="false" AllowAutomaticDeletes="false" DataKeyNames="ID" Name="DiscountItem" ShowHeader="false" EditMode="InPlace" AllowPaging="true" PagerStyle-Position="Bottom" AllowCustomPaging="true"> <SortExpressions> <telerik:GridSortExpression FieldName="SortOrder" SortOrder="Ascending" /> </SortExpressions> <ItemStyle CssClass="Clickable" /> <AlternatingItemStyle CssClass="Clickable" /> <NoRecordsTemplate> <asp:Panel ID='pnlEmpty' runat='server' style='position: relative; width: 100%; height: 30px;'> <asp:Label ID='lblEmpty' runat='server' Text='No Results Found' style='font-weight: bold; position: absolute; top: 10px; left: 10px;' CssClass='StandardText' /> </asp:Panel> </NoRecordsTemplate> <Columns> <telerik:GridTemplateColumn ItemStyle-Width="750px"> <ItemTemplate> <asp:Panel ID='pnlMessage' runat='server' Width="750px" Height="20px"> <asp:Label ID="lblCustomerClause" runat="server" Text="When [Customer] orders "></asp:Label> <asp:Label ID="lblQuantityClause" runat="server" Text="between [Min] and [Max] "></asp:Label> <asp:Label ID="lblItemClause" runat="server" Text="of [Item] "></asp:Label> <asp:Label ID="lblPriceClause" runat="server" Text="the price is [discount_type][discount_value]. "></asp:Label> </asp:Panel> </ItemTemplate> <EditItemTemplate> <asp:Panel ID='pnlEditMessage' runat='server' Width="750px"> <asp:Label ID="lblCustomerClause1" runat="server" Text="When " style='position: relative; top: 3px;'></asp:Label> <telerik:RadComboBox ID="cboCustomerOrGroup" runat="server" Skin="Metro_JobSync" EnableEmbeddedSkins="false" OnClientSelectedIndexChanged="selectCustomerOrGroup"> <Items> <telerik:RadComboBoxItem Text="Customer" Value="C" /> <telerik:RadComboBoxItem Text="Customer Group" Value="G" /> </Items> </telerik:RadComboBox> <asp:TextBox ID='txtCustomer' runat='server' style='width: 120px;' CssClass='StandardText txtCustomer' onkeydown='invalidateCustomerMain();' /> <ajax:AutoCompleteExtender runat='server' ID='acTxtCustomer' TargetControlID='txtCustomer' ServicePath='~/Ajax.asmx' ServiceMethod='SearchCustomer' MinimumPrefixLength='3' CompletionSetCount='10' CompletionInterval='1' CompletionListHighlightedItemCssClass='searchTextMouseOver' CompletionListItemCssClass='searchText' EnableCaching='false' OnClientItemSelected='gridCustomerClicked' FirstRowSelected='true' CompletionListCssClass='searchBox' /> <asp:TextBox ID='hidCustomerID' CssClass="hidCustomerID" style="display: none;" runat='server' Text='0'></asp:TextBox> <asp:TextBox ID='txtCustomerDiscountGroup' runat='server' style='width: 120px;' CssClass='StandardText txtCustomerDiscountGroup' onkeydown='invalidateCustomerMain();' /> <ajax:AutoCompleteExtender runat='server' ID='acCustomerDiscountGroup' TargetControlID='txtCustomerDiscountGroup' ServicePath='~/Ajax.asmx' ServiceMethod='SearchCustomerDiscountGroup' MinimumPrefixLength='1' CompletionSetCount='10' CompletionInterval='1' CompletionListHighlightedItemCssClass='searchTextMouseOver' CompletionListItemCssClass='searchText' EnableCaching='false' FirstRowSelected='true' CompletionListCssClass='searchBox' /> <asp:Label ID="lblCustomerClause2" runat="server" Text=" orders " style='position: relative; top: 3px;'></asp:Label> <telerik:RadComboBox ID="cboQuantityType" runat="server" Width="80px" Skin="Metro_JobSync" EnableEmbeddedSkins="false" OnClientSelectedIndexChanged="selectQuantityType"> <Items> <telerik:RadComboBoxItem Text="up to" Value="<" /> <telerik:RadComboBoxItem Text="at least" Value=">" /> <telerik:RadComboBoxItem Text="between" Value="><" /> </Items> </telerik:RadComboBox> <telerik:RadNumericTextBox runat="server" ID="txtMinQuantity" CssClass="txtMinQuantity" Width="60px"></telerik:RadNumericTextBox> <asp:Label ID="lblQuantityClause2" runat="server" Text=" and " CssClass="lblQuantityClause2" style='position: relative; top: 3px;'></asp:Label> <telerik:RadNumericTextBox runat="server" ID="txtMaxQuantity" CssClass="txtMaxQuantity" Width="60px"></telerik:RadNumericTextBox> <telerik:RadComboBox ID="cboItemOrCategory" runat="server" Width="140px" Skin="Metro_JobSync" EnableEmbeddedSkins="false" OnClientSelectedIndexChanged="selectItemOrCategory"> <Items> <telerik:RadComboBoxItem Text="of item" Value="I" /> <telerik:RadComboBoxItem Text="from item category" Value="C" /> </Items> </telerik:RadComboBox> <asp:TextBox ID='txtItem' runat='server' style='width: 170px;' CssClass='StandardText txtItem' onkeydown='invalidateItemMain();' /> <ajax:AutoCompleteExtender runat='server' ID='acTxtItem' TargetControlID='txtItem' ServicePath='~/Ajax.asmx' ServiceMethod='SearchItemDistinctName' MinimumPrefixLength='3' CompletionSetCount='10' CompletionInterval='1' CompletionListHighlightedItemCssClass='searchTextMouseOver' CompletionListItemCssClass='searchText' EnableCaching='false' OnClientItemSelected='gridItemClicked' FirstRowSelected='true' CompletionListCssClass='searchBox' /> <asp:TextBox ID='hidItemID' CssClass='hidItemID' style="display: none;" runat='server' Text='0'></asp:TextBox> <asp:Label ID="lblLocationClause" runat="server" Text=" from " CssClass="lblLocationClause" style='position: relative; top: 3px;'></asp:Label> <telerik:RadComboBox ID="cboLocation" runat="server" Skin="Metro_JobSync" EnableEmbeddedSkins="false"> </telerik:RadComboBox> <telerik:RadComboBox ID="cboItemCategory" runat="server" Width="312px" ShowToggleImage="True" AutoPostBack="true" Style="vertical-align: middle;" OnClientDropDownOpened="OnClientDropDownOpenedHandler" ExpandAnimation-Type="None" CollapseAnimation-Type="None" Skin="Metro_JobSync" EnableEmbeddedSkins="false"> <ItemTemplate> <asp:Panel ID='pnlTreeView' runat='server' onclick='StopPropagation(event);'> <telerik:RadTreeView ID="tvItemCategory" runat="server" style='position: relative; width: 292px; z-index: 10; color: Black;' Skin="Metro_JobSync" EnableEmbeddedSkins="false"> </telerik:RadTreeView> </asp:Panel> </ItemTemplate> <Items> <telerik:RadComboBoxItem Text="" CssClass="TreeViewWrapper" /> </Items> </telerik:RadComboBox> <asp:Label ID="lblPriceClause" runat="server" Text="the price " style='position: relative; top: 3px;'></asp:Label> <telerik:RadComboBox ID="cboDiscountType" runat="server" Width="170px" Skin="Metro_JobSync" EnableEmbeddedSkins="false"> <Items> <telerik:RadComboBoxItem Text="is discounted by amount " Value="1" /> <telerik:RadComboBoxItem Text="is discounted by percentage " Value="2" /> <telerik:RadComboBoxItem Text="is set to" Value="3" /> </Items> </telerik:RadComboBox> <telerik:RadNumericTextBox runat="server" ID="txtDiscountValue" Width="60px"></telerik:RadNumericTextBox> </asp:Panel> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" ItemStyle-CssClass="EditColumn" UpdateImageUrl="../Images/tick-icon.png" CancelImageUrl="../Images/arrow-undo-icon.png" InsertImageUrl="../Images/tick-icon.png" /> <telerik:GridTemplateColumn ItemStyle-CssClass="DeleteColumn" UniqueName="DeleteColumn" ItemStyle-Width="25px"> <ItemTemplate> <asp:ImageButton ID="imgDelete" runat="server" ImageUrl="~/Images/cross.png" CommandName="Delete" ToolTip="Delete" OnClientClick="return confirm('Are you sure you want to delete this Discount Item?');" CommandArgument='<%# Eval("ID") %>' /> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </telerik:GridTableView> </DetailTables> </MasterTableView></telerik:RadGrid>