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

Attachment download

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

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 :
If
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()
                adapter.Fill(data)
 
                Dim binaryData As Byte() = DirectCast(data.Tables(0).Rows(0)(strcolumn), Byte())
 
                Response.Clear()
                'Response.ClearHeaders() '***
                Response.Cache.SetCacheability(HttpCacheability.Private) '***
                Response.ContentType = "application/octet-stream"
                Response.AddHeader("content-disposition", "attachment; filename=" + fileName)
                Response.BinaryWrite(binaryData)
                Response.[End]()
                
 
            End If

1 Answer, 1 is accepted

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

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,
Andrey
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
Grid
Asked by
Martijn
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or