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
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