I believe my problem is with the firing of events for the grid, but I can't figure out how to make it work the way I need to.
I have a grid (grdDocumentList) with a download link for each row. Clicking on this link fires the ItemCommand event, where I build the path to the selection, stream the object to the user, then log this action in my database. I then need to fire a refresh on a different grid (grdMeetingList). I can't get the refresh to fire since the postback already occurred BEFORE the user got the file.
How do I get this first grid to refresh?
Example1.png shows my form and how it is supposed to work. The left grid shows all meetings, and the binding will display a yellow page icon if the user has documents remaining to download. They click View, the right grid rebinds, and as they click the Download link it should refresh the first grid. If they've downloaded all of the documents (whether it fails or not), the yellow page icon disappears. It's not firing due to the postback firing first.
Here's my code for the second grid:
I have a grid (grdDocumentList) with a download link for each row. Clicking on this link fires the ItemCommand event, where I build the path to the selection, stream the object to the user, then log this action in my database. I then need to fire a refresh on a different grid (grdMeetingList). I can't get the refresh to fire since the postback already occurred BEFORE the user got the file.
How do I get this first grid to refresh?
Example1.png shows my form and how it is supposed to work. The left grid shows all meetings, and the binding will display a yellow page icon if the user has documents remaining to download. They click View, the right grid rebinds, and as they click the Download link it should refresh the first grid. If they've downloaded all of the documents (whether it fails or not), the yellow page icon disappears. It's not firing due to the postback firing first.
Here's my code for the second grid:
Protected Sub grdDocumentList_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles grdDocumentList.ItemCommand If e.CommandName = "Download" Then Dim item As GridDataItem = DirectCast(e.Item, GridDataItem) Dim FileName As String = item("FileDownload").Text Dim MeetingTopicSid As Integer = item("Meeting_TOPIC_SID").Text Dim TargetFile As String = FileName Dim file As System.IO.FileInfo = New System.IO.FileInfo(TargetFile) '-- if the file exists on the server If file.Exists Then 'set appropriate headers Dim liveStream As FileStream = New FileStream(TargetFile, FileMode.Open, FileAccess.Read) Dim buffer(CType(liveStream.Length, Integer)) As Byte liveStream.Read(buffer, 0, CType(liveStream.Length, Integer)) liveStream.Close() Response.ClearHeaders() Response.ClearContent() Response.Clear() Response.ContentType = "application/octet-stream" Response.AddHeader("Content-Length", buffer.Length.ToString) Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name) Response.BinaryWrite(buffer) 'Log User Download SqlHelper.ExecuteNonQuery(ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString").ConnectionString, "usp_InsertMEETING_TOPIC_DOWNLOAD_LOG", Session.Item("gbUserSid"), MeetingTopicSid, DateTime.Now) 'Rebind Grid Me.grdMeetingList.DataBind() End If End IfEnd Sub