Delete command issue

4 posts, 0 answers
  1. Web Services
    Web Services avatar
    243 posts
    Member since:
    Apr 2008

    Posted 30 Dec 2011 Link to this post

    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
    <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
  2. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 03 Jan 2012 Link to this post

    Hello,

    Could you please the same datasource and event handler with an asp:GridView and let me know if the error persists?

    I am looking forward to your reply.

    Kind regards,
    Mira
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Web Services
    Web Services avatar
    243 posts
    Member since:
    Apr 2008

    Posted 04 Jan 2012 Link to this post

    I'm not 100% sure if I did this right, but when I click delete in the grid view, I get this error.

    Server Error in '/' Application.

    Specified argument was out of the range of valid values.
    Parameter name: value


    Here's my asp
    <asp:GridView ID="newDrawingsGrid" runat="server" GridLines="None" DataSourceID="drawingsSqlDataSource"
                        AutoGenerateColumns="false" DataKeyNames="drawingId,productId,pathToPDF">
                        <Columns>
                            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name">
                                <HeaderStyle ForeColor="#336600" Height="23px" Width="200px" />
                            </asp:BoundField>
                            <asp:ButtonField CommandName="Delete" Text="Delete">
                                <HeaderStyle ForeColor="White"
                                            Height="23px" Width="50px" />
                                        <ItemStyle BorderWidth="1px" />
                            </asp:ButtonField>
                        </Columns>
                        </asp:GridView>

    and vb

    Private Sub newDrawingsGrid_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles newDrawingsGrid.RowCommand
        Response.Write("test")
    End Sub




  5. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 09 Jan 2012 Link to this post

    Hello,

    Since the problem can be replicated without the RadGrid, I assume that it is in the datasource and therefore is out of our scope.

    Do not hesitate to contact us if any issue related to the RadControls for ASP.NET AJAX arise.

    Kind regards,
    Mira
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top