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