Microsoft JScript runtime error: Could not complete the operation due to error c00ce514.

2 posts, 0 answers
  1. M Kumar
    M Kumar avatar
    35 posts
    Member since:
    Apr 2008

    Posted 21 Mar 2012 Link to this post

    'I want do download the corresponding file when i click the grid Image button
    'Here i paste my code. it shows this bug(shows in attachment)


    Protected
    Sub ExplorerGrid_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles VersionGrid.ItemCommand
            Dim objGridDataItem As GridDataItem = CType(e.Item, GridDataItem)
     
            Dim stringVersion As String
            stringVersion = objGridDataItem.Item("Version").Text
     
            Dim stringPath As String = Request.QueryString("filepath")
            Dim temppath As String = stringPath.Substring(0, stringPath.LastIndexOf("\"))
            Dim filename As String = stringPath.Substring(stringPath.LastIndexOf("\") + 1)
            filename = filename.Replace("'", "''")
            Dim sqlcon As New SqlConnection(ConfigurationManager.ConnectionStrings("MyConnection").ToString())
     
            Dim objSqlDASec As New SqlDataAdapter("select * from Sample where [DocumentName]= '" + filename + "'", sqlcon)
            objSqlDASec.SelectCommand.CommandTimeout = 1200
     
            Dim objDTSec As New DataSet
            objDTSec.Clear()
     
            objSqlDASec.Fill(objDTSec)
     
            Dim buffer As Byte()
     
            buffer = objDTSec.Tables(0).Rows(0)("Document")
     
            Try
     
                Dim req As New WebClient
                Dim response As HttpResponse
                response = HttpContext.Current.Response
                response.Clear()
                response.ClearContent()
                response.ClearHeaders()
                response.Buffer = True
                response.AddHeader("Content-Disposition", "attachment; filename=" + filename)
                response.ContentType = "application/octet-stream"
                response.BinaryWrite(buffer)
                response.Flush()
                response.End()
     
     
            Catch ex As Exception
     
            End Try
        End Sub

  2. Pavlina
    Admin
    Pavlina avatar
    5246 posts
    Member since:
    Sep 2012

    Posted 26 Mar 2012 Link to this post

    Hi,

    Please refer to the forum thread which elaborates on this matter and let me know if it helps to resolve the problem:
    http://www.telerik.com/community/forums/aspnet-ajax/grid/file-download-functionality.aspx

    All the best,
    Pavlina
    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