Gridview and ReportViewer

M

MasterChief

I have asked this question on the Report Viewer group and haven't
gotten a response yet. I have a page with a gridview and checkboxes.
When I click on a report button I have it posting to a different page
with a report viewer on it. What I want it to do is report all the rows
that have been checked. I can grab the numbers the right way but I
don't know what kind of array to put it in. I have setup a parameter
called pItems to collect the ids. Then in the filter I have set the
item_id field to = pItems. I am all set with that but I am having
problems with the code.

If Not Page.PreviousPage Is Nothing Then
Dim LastPageGrid As New GridView
LastPageGrid =
CType(Page.PreviousPage.FindControl("GridView1"), GridView)

Dim CheckBox As CheckBox

Dim strKeys As String
strKeys = ""

For Each GridViewRow As GridViewRow In LastPageGrid.Rows
CheckBox = CType(GridViewRow.FindControl("chkBox"),
CheckBox)

If CheckBox.Checked = True Then
strKeys +=
LastPageGrid.DataKeys.Item(GridViewRow.RowIndex).Value.ToString
End If
Next

strKeys = Trim(strKeys)

Dim objKeys As New ReportParameter("pItems", strKeys)
ReportViewer1.LocalReport.SetParameters(New
ReportParameter() {objKeys})
ReportViewer1.LocalReport.Refresh()

End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top