Thursday, September 9, 2010

VB.NET GridView Extract Selected Row Value


//on Download Button Click (Download Selected checkbox row index file)

Dim CheckBox As CheckBox

For Each row As GridViewRow In GridView1.Rows
CheckBox = CType(row.FindControl("checkbox1"), CheckBox)
If CheckBox.Checked Then
Response.AppendHeader("Content-Disposition", "attachment; filename=" + row.Cells(1).Text)

Response.TransmitFile("f:/soft/KapiL/uploaded/" + row.Cells(1).Text)
//Response.TransmitFile(Server.MapPath("~/uploaded/" + row.Cells(1).Text))

Response.End()
End If
Next

No comments: