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

Attachment download

1 Answer 84 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Martijn asked on 25 Oct 2012, 06:30 PM

We use 2 grid (not connected) on one page. One grid is in Edit Mode the other shows a attachment

When I download an attachment, then update the other grid with new entered data, the data is not updated
when I push the Update button. It returns to the initial data. When I try to update again it saves the data.  

Anyone any Idea ?

The code I use for downloading the attachment :
e.CommandName = RadGrid.DownloadAttachmentCommandName Then
                e.Canceled = True
                Dim args As GridDownloadAttachmentCommandEventArgs = TryCast(e, GridDownloadAttachmentCommandEventArgs)
                Dim fileName As String = args.FileName
                'Dim column As String = args.CommandSource
                Dim strcolumn As String = args.AttachmentKeyValues("ColumnUniqueName")
                Dim strConnectionString As String = DotNetNuke.Data.SqlDataProvider.Instance.ConnectionString
                Dim conn As New SqlConnection(strConnectionString)
                'Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("TelerikConnectionString").ConnectionString)
                Dim strTable As String = CType(Settings("TableName"), String)
                Dim strUniqueId As String = CType(Settings("UniqueId"), String)
                Dim strid As String = (DirectCast(e.Item, GridDataItem)).GetDataKeyValue(strUniqueId).ToString()
                Dim comm As New SqlCommand("SELECT [" + strcolumn + "]  FROM [" + strTable + "] WHERE [" + strUniqueId + "]=" + strid, conn)
                'comm.Parameters.Add(New SqlParameter("@ID", attachmentId))
                Dim adapter As New SqlDataAdapter(comm)
                Dim data As New DataSet()
                Dim binaryData As Byte() = DirectCast(data.Tables(0).Rows(0)(strcolumn), Byte())
                'Response.ClearHeaders() '***
                Response.Cache.SetCacheability(HttpCacheability.Private) '***
                Response.ContentType = "application/octet-stream"
                Response.AddHeader("content-disposition", "attachment; filename=" + fileName)
            End If

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 30 Oct 2012, 01:37 PM

Based on the provided information it is too hard to find the source of issue. Could you provide more information about your project? Are you using Ajax, how you bind the RadGrid, how the RadGrid is created?

Please elaborate a bit more about your project. Thus all the people who want to help you will have better understanding of your project.

Kind regards,
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.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question