'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