I am trying to call a script to uncheck all checked checkboxes in my gridview upon a button click. The button is an image button that also downloads images that correspond to the rows that are checked. This line of code works in other methods fine but for some reason I cannot figure out, won't work anywhere in this sub.
Protected Sub dwnld_Click(sender As Object, e As ImageClickEventArgs)
Dim found As Boolean = False
Using zip As New ZipFile()
zip.AlternateEncodingUsage = ZipOption.AsNecessary
zip.AddDirectoryByName("Drawings")
For Each row As GridViewRow In gv1.Rows
Dim c As CheckBox = TryCast(row.FindControl("cBox"), CheckBox)
If c.Checked Then
found = True
Dim filepath = serv & row.Cells(1).Text & "B" & row.Cells(3).Text & ".TIF"
zip.AddFile(filepath, "Drawings")
'TryCast(row.FindControl("cBox"), CheckBox).Checked = False
End If
Next
If found Then
Response.Clear()
Response.BufferOutput = False
Dim zipname As String = [String].Format("Drawings_{0}.zip", DateTime.Now.ToString("yyyy-MM-dd-HH:mm:ss"))
Response.ContentType = "application/zip"
Response.AddHeader("content-disposition", "attachment; filename=" + zipname)
zip.Save(Response.OutputStream)
Response.End()
Else
If gv1.Rows.Count > 0 Then
reSetup()
Else
initReSetup()
End If
End If
End Using
End Sub
ScriptManager.RegisterStartupScript(Page, GetType(Page), "Click", "clickb()", True)
Aucun commentaire:
Enregistrer un commentaire