So I have a rad grid where I delete a file using the delete command. It works fine on my test site but when I put it up on our live server and click delete, I just get an object reference not set error. I can't figure out why and have even commented out enough of my code as I was just trying to write the file name being passed in. Do you have any idea why this would work fine on the test site, but then break on the live site? I can provide a full site backup if you want, but here is the relevant code.
asp
Edit* I should mention that I have verified the sp getDrawing is returning the same items on my dev site as the live site and those files do exist.
vb
asp
<telerik:RadGrid ID="drawingsGrid" runat="server" AllowPaging="True" GridLines="None" DataSourceID="drawingsSqlDataSource" AutoGenerateColumns="False" Skin="Telerik"> <MasterTableView DataKeyNames="drawingId,productId,pathToPDF" AllowAutomaticDeletes="True" DataSourceID="drawingsSqlDataSource"> <RowIndicatorColumn Visible="False"> <HeaderStyle Width="20px"></HeaderStyle> </RowIndicatorColumn> <ExpandCollapseColumn Visible="False" Resizable="False"> <HeaderStyle Width="20px"></HeaderStyle> </ExpandCollapseColumn> <Columns> <telerik:GridBoundColumn DataField="Name" HeaderText="Name" SortExpression="Name" UniqueName="Name"> <HeaderStyle ForeColor="#336600" Height="23px" Width="200px" /> </telerik:GridBoundColumn> <telerik:GridButtonColumn ConfirmText="Are you sure you want to delete this drawing? " CommandName="Delete" Text="Delete" UniqueName="columnDelete"> <HeaderStyle ForeColor="White" Height="23px" Width="50px" /> <ItemStyle BorderWidth="1px" /> </telerik:GridButtonColumn> </Columns> <EditFormSettings> <PopUpSettings ScrollBars="None" Width="200px" Height="200px"/> </EditFormSettings> </MasterTableView> <HeaderStyle ForeColor="#336600" /> </telerik:RadGrid>Edit* I should mention that I have verified the sp getDrawing is returning the same items on my dev site as the live site and those files do exist.
vb
Sub On_Record_Deleted(ByVal source As Object, ByVal e As SqlDataSourceStatusEventArgs) If (e.AffectedRows > 0) Then Response.Write(pdfFileToDelete) 'If Not String.IsNullOrEmpty(pdfFileToDelete) Then ' Try ' File.Delete(Server.MapPath(pdfFileToDelete)) ' Catch ex As Exception ' msgLabel.Text = ex.ToString ' End Try 'End If End If End Sub