<%Using Html.BeginForm("Print", "Secure", Nothing, FormMethod.Post , New With {.target="_blank"})%>
Turns out that the form tag always included the target attribute, you just need to instruct the BeginForm helper to use it.
<%Using Html.BeginForm("Print", "Secure", Nothing, FormMethod.Post , New With {.target="_blank"})%>
Dim startTime As DateTime = DateTime.Now()
Dim recordsToProcess As Integer = 0
Dim recordsProcessed As Integer = 0
Dim recordsErrored As Integer = 0
recordsToProcess = dataSetWithRecords.Tables(0).Rows.Count
For Each drCurrentRecord As DataRow In dataSetWithRecords.Tables(0).Rows
'do processing here
Try
'execute task
.
.
.
'update success counter
recordsProcessed += 1
Catch ex as Exception
'handle error state
'update error counter
recordsErrored += 1
End Try
Next
Dim endTime As DateTime = DateTime.Now
Dim timeElapsedSeconds As Double = DateDiff(DateInterval.Second, startTime, endTime)
Dim timeElapsedSpan As TimeSpan = New TimeSpan(0, 0, timeElapsedseconds)
Dim sbSummary As New System.Text.StringBuilder
sbSummary.AppendLine("Agent Results:")
sbSummary.AppendFormat("Total records to process:{0}", recordsToProcess.ToString)
sbSummary.AppendLine()
sbSummary.AppendFormat("Records processed Successfully: {0}",recordsProcessed.ToString)
sbSummary.AppendLine()
sbSummary.AppendFormat("Records with errors: {0}", recordsErrored.ToString)
sbSummary.AppendLine()
sbSummary.AppendFormat("Processing Time: {0} Hours, {1} Minutes, {2} Seconds", timeElapsedSpan.Hours, timeElapsedSpan.Minutes, timeElapsedSpan.Seconds)
sbSummary.AppendLine()
LogMessage(sbSummary.ToString)