I've narrowed the most likely cause of the problem to the actual code that fires in the event. It creates a vCal file in memory and streams it to the client. The odd part of it is that it worked up until I made some unrelated changes to the user control
in which the Repater sits. I'll probably just hack it and make the ItemCommand open a page that handles creating the vCal stand alone.
Protected Sub RepeaterShowGateway_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles RepeaterShowGateway.ItemCommand
Select Case e.CommandName
Case "CreateCalendarItem"
Exit Sub
'http://www.codeproject.com/KB/aspnet/vcalendarfiletodownload.aspx
'PARAMETERS
Dim LabelNameLong As Label = CType(e.Item.FindControl("LabelNameLong"), Label)
Dim LabelBranchNameShort As Label = CType(e.Item.FindControl("LabelBranchNameShort"), Label)
Dim LabelShowNumber As Label = CType(e.Item.FindControl("LabelShowNumber"), Label)
Dim vcal_LabelTFCMoveIn As Label = CType(e.Item.FindControl("vcal_LabelTFCMoveIn"), Label)
Dim beginDate As Date = vcal_LabelTFCMoveIn.Text
Dim vcal_LabelTFCClear As Label = CType(e.Item.FindControl("vcal_LabelTFCClear"), Label)
Dim endDate As Date = vcal_LabelTFCClear.Text
'INITIALIZATION
Dim mStream As New MemoryStream()
Dim writer As New StreamWriter(mStream)
writer.AutoFlush = True
'HEADER
writer.WriteLine("BEGIN:VCALENDAR")
writer.WriteLine("PRODID:-//Flo Inc.//FloSoft//EN")
writer.WriteLine("BEGIN:VEVENT")
'BODY
writer.WriteLine("DTSTART;VALUE=DATE:" & _
beginDate.ToUniversalTime.ToString("yyyyMMdd"))
writer.WriteLine("DTEND;VALUE=DATE:" & _
endDate.ToUniversalTime.ToString("yyyyMMdd"))
writer.WriteLine("LOCATION:")
'Add Links here to Booking Report, QF, Sharepoint Folder and Show Site Dashboard
writer.WriteLine("DESCRIPTION:" & "Message Body Here")
writer.WriteLine("SUMMARY:" & LabelNameLong.Text & " " & "(" & LabelBranchNameShort.Text & "-" & LabelShowNumber.Text & ")")
'FOOTER
writer.WriteLine("PRIORITY:3")
writer.WriteLine("END:VEVENT")
writer.WriteLine("END:VCALENDAR")
'MAKE IT DOWNLOADABLE
Response.Clear() 'clears the current output content from the buffer
Response.AppendHeader("Content-Disposition", _
"attachment; filename=OutlookAppointment.vcs")
Response.AppendHeader("Content-Length", mStream.Length.ToString())
Response.ContentType = "application/download"
Response.BinaryWrite(mStream.ToArray())
Response.End()
Case Else
End Select
End Sub
dch3
Member
447 Points
638 Posts
Re: Repeater ItemCommand Throws Error When Executed Within Update Panel
May 22, 2012 02:37 PM|LINK
I've narrowed the most likely cause of the problem to the actual code that fires in the event. It creates a vCal file in memory and streams it to the client. The odd part of it is that it worked up until I made some unrelated changes to the user control in which the Repater sits. I'll probably just hack it and make the ItemCommand open a page that handles creating the vCal stand alone.
Protected Sub RepeaterShowGateway_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles RepeaterShowGateway.ItemCommand Select Case e.CommandName Case "CreateCalendarItem" Exit Sub 'http://www.codeproject.com/KB/aspnet/vcalendarfiletodownload.aspx 'PARAMETERS Dim LabelNameLong As Label = CType(e.Item.FindControl("LabelNameLong"), Label) Dim LabelBranchNameShort As Label = CType(e.Item.FindControl("LabelBranchNameShort"), Label) Dim LabelShowNumber As Label = CType(e.Item.FindControl("LabelShowNumber"), Label) Dim vcal_LabelTFCMoveIn As Label = CType(e.Item.FindControl("vcal_LabelTFCMoveIn"), Label) Dim beginDate As Date = vcal_LabelTFCMoveIn.Text Dim vcal_LabelTFCClear As Label = CType(e.Item.FindControl("vcal_LabelTFCClear"), Label) Dim endDate As Date = vcal_LabelTFCClear.Text 'INITIALIZATION Dim mStream As New MemoryStream() Dim writer As New StreamWriter(mStream) writer.AutoFlush = True 'HEADER writer.WriteLine("BEGIN:VCALENDAR") writer.WriteLine("PRODID:-//Flo Inc.//FloSoft//EN") writer.WriteLine("BEGIN:VEVENT") 'BODY writer.WriteLine("DTSTART;VALUE=DATE:" & _ beginDate.ToUniversalTime.ToString("yyyyMMdd")) writer.WriteLine("DTEND;VALUE=DATE:" & _ endDate.ToUniversalTime.ToString("yyyyMMdd")) writer.WriteLine("LOCATION:") 'Add Links here to Booking Report, QF, Sharepoint Folder and Show Site Dashboard writer.WriteLine("DESCRIPTION:" & "Message Body Here") writer.WriteLine("SUMMARY:" & LabelNameLong.Text & " " & "(" & LabelBranchNameShort.Text & "-" & LabelShowNumber.Text & ")") 'FOOTER writer.WriteLine("PRIORITY:3") writer.WriteLine("END:VEVENT") writer.WriteLine("END:VCALENDAR") 'MAKE IT DOWNLOADABLE Response.Clear() 'clears the current output content from the buffer Response.AppendHeader("Content-Disposition", _ "attachment; filename=OutlookAppointment.vcs") Response.AppendHeader("Content-Length", mStream.Length.ToString()) Response.ContentType = "application/download" Response.BinaryWrite(mStream.ToArray()) Response.End() Case Else End Select End Sub