I know that I must be missing something simple but I can't figure it out. I have just changed all of my grids from the RadControls to the Prometheus controls. In doing so (something I did or didn't do) broke. When ever I try to use the CommandItemTemplate Update Button I get an error:
Only items with IsInEditMode set to true can be updated
Here is my commandItemTemplate:
As far as I know it is the same as the Prometheus examples. If I use the update button from the EditFormsSettings it works fine.
Here is the Grid:
Can someone point out what I am doing wrong?
Thanks
Only items with IsInEditMode set to true can be updated
Here is my commandItemTemplate:
| <CommandItemTemplate> |
| <asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="UpdateEdited" Visible='<%# RadGrid1.EditIndexes.Count > 0 %>'> |
| <img style="border:0px" alt="" src="~/Skins/DWDS/Grid/Update.gif" runat="server" /> Update Activity |
| </asp:LinkButton> |
As far as I know it is the same as the Prometheus examples. If I use the update button from the EditFormsSettings it works fine.
Here is the Grid:
| <telerik:RadGrid ID="RadGrid1" Skin="DWDS" EnableEmbeddedSkins="false" ImagesPath="~/Skins/DWDS/Grid/" runat="server" Width="100%" PageSize="14" |
| AllowAutomaticDeletes="true" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" |
| AllowPaging="True" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" ShowStatusBar="true" AllowSorting="true" ShowFooter="true" AllowFilteringByColumn="true" > |
| <PagerStyle Mode="NextPrevNumericAndAdvanced" /> |
| <ExportSettings FileName="DeepWellData File Export" /> |
| <MasterTableView CommandItemDisplay="Top" CurrentResetPageIndexAction="SetPageIndexToFirst" ShowHeadersWhenNoRecords="true" DataKeyNames="Activity_ID" DataSourceID="SqlDataSource1" Width="100%" AutoGenerateColumns="false" EditMode="EditForms"> |
| <CommandItemTemplate> |
| <asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="UpdateEdited" Visible='<%# RadGrid1.EditIndexes.Count > 0 %>'> |
| <img style="border:0px" alt="" src="~/Skins/DWDS/Grid/Update.gif" runat="server" /> Update Activity |
| </asp:LinkButton> |
| |
| <asp:LinkButton ID="btnCancel" runat="server" CommandName="CancelAll" Visible='<%# RadGrid1.EditIndexes.Count > 0 || RadGrid1.MasterTableView.IsItemInserted %>'> |
| <img style="border:0px" alt="" src="~/Skins/DWDS/Grid/Cancel.gif" runat="server" /> Cancel editing |
| </asp:LinkButton> |
| |
| <asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert" Visible='<%# !RadGrid1.MasterTableView.IsItemInserted %>'> |
| <img style="border:0px" alt="" src="~/Skins/DWDS/Grid/AddRecord.gif" runat="server" /> Add new Activity</asp:LinkButton> |
| <asp:LinkButton ID="LinkButton3" runat="server" CommandName="PerformInsert" Visible='<%# RadGrid1.MasterTableView.IsItemInserted %>'> |
| <img style="border:0px" alt="" src="~/Skins/DWDS/Grid/Insert.gif" runat="server" /> Add this Activity</asp:LinkButton> |
| |
| <asp:LinkButton ID="LinkButton4" runat="server" CommandName="RebindGrid"> |
| <img style="border:0px" alt="" src="~/Skins/DWDS/Grid/Refresh.gif" runat="server" /> Refresh Activity list |
| </asp:LinkButton> |
| |
| <asp:Label ID="lblCategoryEdit" Visible="false" OnDataBinding="DisableCategoryEdit" runat="server"> |
| <telerik:RadWindowManager ID="RadWindowManager2" runat="server" Height="500px" Width="480px" Modal="true"> |
| <Windows> |
| <telerik:RadWindow OpenerElementID="aRegion" Width="480px" Height="450px" NavigateUrl="~/Projects/CaseFiles/AddRecord/Category.aspx" ID="RadWindow1" runat="server" /> |
| </Windows> |
| </telerik:RadWindowManager> |
| <a id="aRegion" style="cursor: pointer;"> |
| <img src="~/Skins/DWDS/Grid/Edit.gif" runat="server" border="0" alt="Edit Categories" />Add/Edit Categories</a> </asp:Label> |
| <br /> |
| |
| </CommandItemTemplate> |
| <Columns> |
| <telerik:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="~\Skins\DWDS\Grid\Edit.gif" |
| UniqueName="EditColumn"> |
| <HeaderStyle Width="25px" /> |
| <ItemStyle HorizontalAlign="Center" Width="25px" /> |
| </telerik:GridEditCommandColumn> |
| <telerik:GridButtonColumn ConfirmText="Delete this activity?" ButtonType="ImageButton" ImageUrl="~\Skins\DWDS\Grid\Delete.gif" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"> |
| <HeaderStyle Width="25px" /> |
| <ItemStyle HorizontalAlign="Center" Width="25px" /> |
| </telerik:GridButtonColumn> |
| <telerik:GridBoundColumn DataField="Activity_ID" HeaderText="ID" ReadOnly="True" SortExpression="Name" UniqueName="Activity_ID" Visible="False" /> |
| <telerik:GridBoundColumn DataField="Name" HeaderText="Activity Name" ColumnEditorID="GridTextBoxColumnEditor1" SortExpression="Name" UniqueName="name" /> |
| <telerik:GridBoundColumn DataField="PName" HeaderText="Partner" ReadOnly="True" Display="true" SortExpression="PName" UniqueName="PName" /> |
| <telerik:GridBoundColumn DataField="Category_Name" HeaderText="Category" ReadOnly="True" Display="true" SortExpression="Category_Name" UniqueName="Category_Name" /> |
| <telerik:GridDropDownColumn DataField="Partner_ID" ColumnEditorID="GridDropDownListColumnEditor1" DataSourceID="SqlDataSource2" HeaderText="Partner" ListTextField="Name" ListValueField="Partner_ID" |
| UniqueName="pid" Display="false" /> |
| <telerik:GridDropDownColumn DataField="Category_ID" ColumnEditorID="GridDropDownListColumnEditor2" DataSourceID="SqlDataSource3" HeaderText="Category" ListTextField="Name" ListValueField="Category_ID" |
| UniqueName="cid" Display="false" /> |
| <telerik:GridDropDownColumn DataField="Goal_Number" ColumnEditorID="GridDropDownListColumnEditor3" DataSourceID="SqlDataSource7" Visible="false" HeaderText="Goal #" ListTextField="Goal" |
| ListValueField="Goal" UniqueName="Goal_number" /> |
| <telerik:GridNumericColumn DataField="Completion_Hours" Visible="false" HeaderText="Completion Hours (in Minutes)" ColumnEditorID="GridNumericColumnEditor1" SortExpression="Completion_Hours" |
| UniqueName="Completion_Hours" /> |
| <telerik:GridTemplateColumn HeaderText="Details" AllowFiltering="false" DataField="Activity_ID" UniqueName="viewActivity"> |
| <ItemTemplate> |
| <div style="text-align: center"> |
| <asp:ImageButton ID="showItem" OnClick="showActivityDetails_Click" runat="server" ImageUrl="~/Images/Icons/magnifier.gif" CommandName="viewingActivity" CommandArgument='<%# Eval("Activity_ID") %>' /> |
| </div> |
| </ItemTemplate> |
| <FooterTemplate> |
| <div style="font-size: 11px; color: #5e7ca7; padding-top: 2px"> |
| Export to:<br /> |
| <asp:ImageButton ID="btnExcel" runat="server" ImageUrl="~/Images/Icons/excel.gif" AlternateText="Export to excel" OnClick="btnExcel_Click" /> |
| <asp:ImageButton ID="btnWord" runat="server" ImageUrl="~/Images/Icons/word.gif" AlternateText="Export to word" OnClick="btnWord_Click" /> |
| </div> |
| </FooterTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridHTMLEditorColumn Visible="false" DataField="Notes" ColumnEditorID="GridHTMLEditorColumnEditor1" HeaderText="Notes" SortExpression="Notes" UniqueName="Notes" /> |
| <telerik:GridBoundColumn Visible="false" DataField="Partner_ID" UniqueName="Partner_ID" ReadOnly="true" /> |
| <telerik:GridBoundColumn DataField="PName" Visible="false" UniqueName="PName2" ReadOnly="true" /> |
| </Columns> |
| <EditFormSettings CaptionDataField="Name" CaptionFormatString="Edit properties of Activity: {0}" ColumnNumber="1"> |
| <FormTableItemStyle Wrap="False" Width="400px"></FormTableItemStyle> |
| <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle> |
| <FormMainTableStyle GridLines="Horizontal" CellSpacing="10" CellPadding="10" BackColor="White" /> |
| <FormTableStyle CellSpacing="10" CellPadding="10" CssClass="module" Height="150px" BackColor="White" /> |
| <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle> |
| <FormStyle Width="10%"></FormStyle> |
| <EditColumn ButtonType="ImageButton" UpdateImageUrl="~\Skins\DWDS\Grid\Update.gif" EditImageUrl="~\Skins\DWDS\Grid\Edit.gif" InsertImageUrl="~\Skins\DWDS\Grid\Insert.gif" CancelImageUrl="~\Skins\DWDS\Grid\Cancel.gif" |
| InsertText="Insert Activity" UpdateText="Update record" UniqueName="EditCommandColumn1" CancelText="Cancel edit"> |
| </EditColumn> |
| <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle> |
| </EditFormSettings> |
| <ExpandCollapseColumn Visible="False"> |
| <HeaderStyle Width="19px" /> |
| </ExpandCollapseColumn> |
| <RowIndicatorColumn Visible="False"> |
| <HeaderStyle Width="20px" /> |
| </RowIndicatorColumn> |
| </MasterTableView> |
| </telerik:RadGrid> |
Can someone point out what I am doing wrong?
Thanks