Please note that I do not have a TemplateColumn in my grid to adding a blank ItemTemplate will not work. I read the forums until I am tired of doing it. If I refresh the grid after clearing the IE8 error popup, the record is deleted. I get the prompt, and the record gets deleted, but I simply must know how to get rid of this stupid message.
I'm guessing it's something with databinding, but I have no idea what.
Please help if possible. I appreciate the help in advance.
Jason
Datasource...
<asp:LinqDataSource ID="ldsDeviceToDeviceInfo" runat="server"
ContextTypeName="AssetManagementDataContext" EnableDelete="True"
EnableInsert="True" EnableUpdate="True" EntityTypeName=""
OrderBy="DeviceName, ConnType" TableName="Connections">
</asp:LinqDataSource>
I have this in my RadAjaxManager (among other things not related to this grid):
<telerik:AjaxSetting AjaxControlID="grdDevToDev">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="grdDevToDev" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
ASPX RadGrid declaration:
<telerik:RadGrid ID="grdDevToDev" runat="server" EnableLinqExpressions="False" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" CellSpacing="0" DataSourceID="ldsDeviceToDeviceInfo" Font-Names="Verdana" Font-Size="8px" GridLines="None" Skin="WebBlue" Width="90%" AutoGenerateColumns="False" onitemcommand="grdDevToDev_ItemCommand"> <ClientSettings AllowColumnsReorder="True" AllowKeyboardNavigation="true" ReorderColumnsOnClient="True" EnablePostBackOnRowClick="false" > <Selecting AllowRowSelect="True" /> <ClientEvents OnPopUpShowing="PopUpShowing" /> </ClientSettings> <MasterTableView DataKeyNames="Index" AllowAutomaticDeletes="true" DataSourceID="ldsDeviceToDeviceInfo" EditMode="Popup" CommandItemDisplay="Top" > <Columns> <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn> <telerik:GridBoundColumn DataField="Index" DataType="System.Int64" FilterControlAltText="Filter Index column" HeaderText="Index" ReadOnly="True" SortExpression="Index" UniqueName="Index" Visible="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="DeviceName" FilterControlAltText="Filter DeviceName column" HeaderText="DeviceName" SortExpression="DeviceName" UniqueName="DeviceName"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ConnType" FilterControlAltText="Filter ConnType column" HeaderText="ConnType" SortExpression="ConnType" UniqueName="ModConnTypeel"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="CableType" FilterControlAltText="Filter CableType column" HeaderText="CableType" SortExpression="CableType" UniqueName="CableType"> <HeaderStyle Width="150px" /> </telerik:GridBoundColumn> <telerik:GridButtonColumn ConfirmText="Delete this record?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="LinkButton" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"> <HeaderStyle Width="50" /> <ItemStyle HorizontalAlign="Center" /> </telerik:GridButtonColumn> </Columns> <EditFormSettings InsertCaption="Assign/Modify Device to Device Connection" CaptionFormatString="Edit Record: {0}" CaptionDataField="Index" EditFormType="Template"> <PopUpSettings Modal="True" Width="500px" Height="500px" /> <FormTemplate> <table id="Table1" cellspacing="0" cellpadding="3" width="450" border="0"> <tr> <td colspan="3" style="height: 50px"> <asp:ValidationSummary ID="valSummaryNewDevice" ValidationGroup="SaveNewDevice" runat="server" ForeColor="DarkRed" Width="670px" /> </td> </tr> <tr> <td colspan="3"> <br /> </td> </tr> <tr> <td style="width: 20px;"> </td> <td style="width: 150px; padding: 1px 2px 1px 2px"> <asp:Label ID="Label3" runat="server" CssClass="formLabel" Height="20px" Text="ID"></asp:Label> </td> <td> <asp:Label ID="tbIndex" Font-Names="Verdana" Font-Size="8pt" runat="server" Text='<%# Bind("Index") %>' Width="50px" ></asp:Label> </td> </tr> <tr> <td style="width: 20px;"> </td> <td style="width: 150px; padding: 1px 2px 1px 2px"> <asp:Label ID="Label6" runat="server" CssClass="formLabel" Height="20px" Text="Device Name"></asp:Label> </td> <td> <asp:TextBox ID="tbAddDeviceName" Width="200px" Text='<%# Bind("DeviceName") %>' Font-Names="verdana" Font-Size="8pt" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="valNewDeviceSubmit" ControlToValidate="tbAddDeviceName" SetFocusOnError="true" ValidationGroup="SaveNewDevice" Display="Dynamic" ErrorMessage="Missing Device Name" runat="server"> <img id="Img5" src="~/images/flag_red.png" runat="server" alt="Missing data" /></asp:RequiredFieldValidator> </td> </tr> <tr> <td style="width: 20px;"> </td> <td style="width: 150px; padding: 1px 2px 1px 2px"> <asp:Label ID="Label7" runat="server" CssClass="formLabel" Height="20px" Text="Device Type"></asp:Label> </td> <td> <%-- <telerik:RadComboBox ID="rcbAddDeviceType" runat="server" Font-Names="Verdana" Font-Size="8pt" AllowCustomText="true" MarkFirstMatch="True" NoWrap="True" Skin="Windows7" SortCaseSensitive="False" SelectedValue='<%# Bind("Model") %>' MaxHeight="250px" Width="200px" DataSourceID="dsDeviceTypes" DataTextField="Device_Type" DataValueField="Device_Type" AutoPostBack="False" AppendDataBoundItems="true"> <Items> <telerik:RadComboBoxItem Text="" Value="" /> </Items> </telerik:RadComboBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="rcbAddDeviceType" SetFocusOnError="true" ValidationGroup="SaveNewDevice" Display="Dynamic" ErrorMessage="Missing Device Type" runat="server"> <img id="Img1" src="~/images/flag_red.png" runat="server" alt="Missing data" /></asp:RequiredFieldValidator>--%> </td> </tr> <tr> <td style="width: 20px;"> </td> <td> <asp:Label ID="Label8" runat="server" CssClass="formLabel" Height="20px" Text="Cabinet"></asp:Label> </td> <td> <%-- <telerik:RadComboBox ID="rcbAddDeviceCabinet" runat="server" Font-Names="Verdana" AllowCustomText="true" Font-Size="8pt" MarkFirstMatch="True" NoWrap="True" AutoPostBack="False" Skin="Windows7" SortCaseSensitive="False" MaxHeight="250px" Width="200px" DataSourceID="dsCabNums" SelectedValue='<%# Bind("Rack") %>' DataTextField="CabinetNumber" DataValueField="CabinetNumber" AppendDataBoundItems="true" > <Items> <telerik:RadComboBoxItem Text="" Value="" /> </Items> </telerik:RadComboBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="rcbAddDeviceCabinet" SetFocusOnError="true" ValidationGroup="SaveNewDevice" Display="Dynamic" ErrorMessage="Missing Cabinet" runat="server"> <img id="Img3" src="~/images/flag_red.png" runat="server" alt="Missing data" /></asp:RequiredFieldValidator>--%> </td> </tr> <tr> <td style="width: 20px;"> </td> <td style="width: 150px; padding: 1px 2px 1px 2px"> <asp:Label ID="Label9" runat="server" CssClass="formLabel" Height="20px" Text="RU Position"></asp:Label> </td> <td> <%-- <asp:TextBox ID="tbRUPosition" Text='<%# Bind("Rack_Position") %>' Width="200px" Font-Names="verdana" Font-Size="8pt" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator3" ControlToValidate="tbRUPosition" SetFocusOnError="true" ValidationGroup="SaveNewDevice" Display="Dynamic" ErrorMessage="Missing RU Position" runat="server"> <img id="Img4" src="~/images/flag_red.png" runat="server" alt="Missing data" /></asp:RequiredFieldValidator>--%> </td> </tr> <tr> <td style="width: 20px;"> </td> <td colspan="2"> <%--<hr />--%> </td> </tr> <tr> <td colspan="3"> <br /> </td> </tr> </table> <table style="width: 100%"> <tr> <td align="center" colspan="2"> <table> <tr> <td> <telerik:RadButton ID="Button1" ValidationGroup="SaveNewDevice" TabIndex="14" CausesValidation="true" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Save" %>' runat="server" Skin="WebBlue" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'> </telerik:RadButton> </td> <td> <telerik:RadButton ID="btnCancel" CommandName="Cancel" TabIndex="15" Text="Cancel" CausesValidation="False" runat="server" Skin="WebBlue"> </telerik:RadButton> </td> </table> </tr> </td> </tr> </table> </FormTemplate> <EditColumn UniqueName="EditCommandColumn1"> </EditColumn> <FormTableButtonRowStyle HorizontalAlign="Center" /> </EditFormSettings> </MasterTableView> </telerik:RadGrid>Only method in code-behind for this grid:
protected void grdDevToDev_ItemCommand(object sender, GridCommandEventArgs e) { AssetManagementDataContext dc = new AssetManagementDataContext(); if (e.CommandName == RadGrid.DeleteCommandName) { var index = (int)((GridDataItem)e.Item).GetDataKeyValue("Index"); //retrieve entity form the Db var device = dc.Connections.Where(n => n.Index == index).FirstOrDefault(); if (device != null) { //add the category for deletion dc.Connections.DeleteOnSubmit(device); try { //submit chanages to Db dc.SubmitChanges(); grdAddSwitch.Rebind(); } catch (System.Exception exc) { Response.Write("Error deleting switch.\nError Message: " + exc.Message); } } } }