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

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

1 Answer 98 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
M Kumar
Top achievements
Rank 1
Iron
Veteran
M Kumar asked on 21 Mar 2012, 05:40 AM
'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

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 26 Mar 2012, 10:42 AM
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.
Tags
General Discussions
Asked by
M Kumar
Top achievements
Rank 1
Iron
Veteran
Answers by
Pavlina
Telerik team
Share this question
or