I have gridview of many rows but i want to print in crystal report only the rows
which i have selected.
My gridview4 display the selected rows and while i print it prints all the row.
Thanks.
For Each row As GridViewRow In gvCancelReservation.Rows
Dim ChkCancel As CheckBox = TryCast(row.Cells(1).FindControl("chkRow"), CheckBox)
If ChkCancel.Checked Then
cccmd1.CommandType = CommandType.Text
Dim Vin As String
Vin = row.Cells(2).Text
'cccmd1.CommandText = "Select Vin,[Purchase Date],Stock_Type,[Model Year],[Model No_],[Model Code],Location,Resrv_Id,Color,Upholstery,[Stock No_],[OCN Desc],Sales_Person_Name,Customer_Name,CustCivilId,CustDeposit,CustReservationDate from R_View_Stock_Reserve_Print where (Status = 'Check' or Status = 'Confirmed') and Resrv_Id='" & txtTransId.Text & "'"
cccmd1.CommandText = "Select Vin,[Purchase Date],Stock_Type,[Model Year],[Model No_],[Model Code],Location,Resrv_Id,Color,Upholstery,[Stock No_],[OCN Desc],Sales_Person_Name,Customer_Name,CustCivilId,CustDeposit,CustReservationDate from R_View_Stock_Reserve_Print where (Status = 'Check' or Status = 'Confirmed') and Vin='" & Vin & "'"
cccmd1.Connection = coN
Dim aDQRN1 As New SqlDataAdapter(cccmd1)
'aDQRN1.Fill(ddss.R_View_Stock_Reserve_Print)
Dim rdoc1 As New ReportDocument
rdoc1.Load(Server.MapPath("ReservationCrystalReport.rpt"))
rdoc1.SetDataSource(ddss)
rdoc1.SetParameterValue("ResId", txtTransId.Text)
rdoc1.SetParameterValue("Vin", Vin)
GridView4.DataSource = dTPrint
GridView4.DataBind()
GridView4.Visible = True
CrystalReportViewer2.ReportSource = rdoc1
CrystalReportViewer2.DataBind()
CrystalReportViewer2.Visible = True
coN.Close()
End If
Next