This is a migrated thread and some comments may be shown as answers.

Works in IE but not Firefox

1 Answer 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Cyrus
Top achievements
Rank 1
Cyrus asked on 02 Mar 2009, 11:10 PM
I thought I was home free today but alas I was thwarted by Firefox.  The following code throws an error in Firefox but works just fine in IE 7.0  Any ideas?  I am using the SessionDataSource since I have a page which I want to use a grid but not store any data.

The error thrown is:

Unable to locate record to delete. Please asure you have selected the DataKeyNames propery.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Unable to locate record to delete. Please asure you have selected the DataKeyNames propery.


 
<cc2:SessionDataSource ID="Asset" runat="server" DisplayWarning="False" ClearSessionOnInitialLoad="True" 
                DataFile="~/App_Data/AssetSession.mdb" DeleteCommand="DELETE FROM [Asset] WHERE [ID] = ?" 
                InsertCommand="INSERT INTO [Asset] ([ID], [Description], [RMA], [TAG], [PO], [Serial], [Value]) VALUES (?, ?, ?, ?, ?, ?, ?)" 
                SelectCommand="SELECT * FROM [Asset]" SessionKey="System.Web.UI.Page_Asset" PrimaryKeyFields="ID" 
                UpdateCommand="UPDATE [Asset] SET [Description] = ?, [RMA] = ?, [TAG] = ?, [PO] = ?, [Serial] = ?, [Value] = ? WHERE [ID] = ?">  
                <UpdateParameters> 
                    <asp:Parameter Name="Description" Type="String" /> 
                    <asp:Parameter Name="RMA" Type="String" /> 
                    <asp:Parameter Name="TAG" Type="String" /> 
                    <asp:Parameter Name="PO" Type="String" /> 
                    <asp:Parameter Name="Serial" Type="String" /> 
                    <asp:Parameter Name="Value" Type="String" /> 
                    <asp:Parameter Name="ID" Type="Int32" /> 
                </UpdateParameters> 
                <DeleteParameters> 
                    <asp:Parameter Name="ID" Type="Int32" /> 
                </DeleteParameters> 
                <InsertParameters> 
                    <asp:Parameter Name="ID" Type="Int32" /> 
                    <asp:Parameter Name="Description" Type="String" /> 
                    <asp:Parameter Name="RMA" Type="String" /> 
                    <asp:Parameter Name="TAG" Type="String" /> 
                    <asp:Parameter Name="PO" Type="String" /> 
                    <asp:Parameter Name="Serial" Type="String" /> 
                    <asp:Parameter Name="Value" Type="String" /> 
                </InsertParameters> 
            </cc2:SessionDataSource> 
            <telerik:RadGrid ID="assetGrid" runat="server" DataSourceID="Asset" GridLines="None" 
                AllowAutomaticInserts="True" Skin="Office2007" AutoGenerateColumns="False" AllowAutomaticDeletes="true">  
                <HeaderContextMenu EnableTheming="True">  
                    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
                </HeaderContextMenu> 
                <ClientSettings> 
                    <Selecting AllowRowSelect="True" /> 
                </ClientSettings> 
                <MasterTableView DataKeyNames="ID" DataSourceID="Asset" EditMode="EditForms" CommandItemDisplay="Bottom">  
                    <CommandItemTemplate> 
                        <div class="noprint">  
                            <asp:Button ID="btnAdd" runat="server" Text="Add New Item" CommandName="InitInsert">  
                            </asp:Button> 
                            <asp:Button ID="btnDelete" runat="server" Text="Delete Selected Item" ToolTip="Click item to select" CommandName="DeleteSelected">  
                            </asp:Button>                              
                        </div> 
                    </CommandItemTemplate> 
                    <EditFormSettings> 
                        <EditColumn UniqueName="InsertCommandColumn" ButtonType="PushButton" InsertText="Insert Item"></EditColumn> 
                    </EditFormSettings> 
                    <RowIndicatorColumn> 
                        <HeaderStyle Width="20px"></HeaderStyle> 
                    </RowIndicatorColumn> 
                    <ExpandCollapseColumn> 
                        <HeaderStyle Width="20px"></HeaderStyle> 
                    </ExpandCollapseColumn> 
                    <Columns> 
                        <telerik:GridBoundColumn DataField="ID" HeaderText="ID" SortExpression="ID" UniqueName="ID" 
                            DataType="System.Int32" ReadOnly="True">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="Description" HeaderText="Description" SortExpression="Description" 
                            UniqueName="Description" MaxLength="33">                              
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="RMA" HeaderText="RMA" SortExpression="RMA" UniqueName="RMA" 
                            MaxLength="18">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="TAG" HeaderText="TAG" SortExpression="TAG" UniqueName="TAG" 
                            MaxLength="8">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="PO" HeaderText="PO" SortExpression="PO" UniqueName="PO" 
                            MaxLength="11">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="Serial" HeaderText="Serial" SortExpression="Serial" 
                            UniqueName="Serial" MaxLength="18">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="Value" HeaderText="Value" SortExpression="Value" 
                            UniqueName="Value" MaxLength="8">  
                        </telerik:GridBoundColumn> 
                    </Columns> 
                </MasterTableView> 
                <FilterMenu EnableTheming="True">  
                    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
                </FilterMenu> 
            </telerik:RadGrid> 

Again, it works just perfect in IE 7.0...not in Firefox 3.0.5

 

 I have just updated my code with your newer version of the SessionDataSource.cs code (had to convert to vb). and get the same error just in Firefox :(  I have put A LOT of time into this project and don't want to see it fail...please help!

Line 252:                Dim res As DataRow() = sessionTable.[Select]([select])  
Line 253:                If res.Length <> 1 Then  
Line 254:                    Throw New InvalidOperationException("Unable to locate record to delete. Please asure you have selected the DataKeyNames propery.")  
Line 255:                End If  
Line 256: 

 

 

1 Answer, 1 is accepted

Sort by
0
Cyrus
Top achievements
Rank 1
answered on 03 Mar 2009, 06:06 PM
I found the issue...and it was totally a fluke....Yahoo's YSlow plugin casued this issue...I updateed to the latest version and still it was casuing this error.

Anyone know why this might be happening?  Kind of sucks but at least I found the issue.
Tags
Grid
Asked by
Cyrus
Top achievements
Rank 1
Answers by
Cyrus
Top achievements
Rank 1
Share this question
or