I am making a Crystal-Report from data of GridView. The GridView has three columns in which two columns are filled with values coming from DataBase in a label and third column has a CheckBox which on check sends the value of these two columns as query string to the .cs page of Crystal-Report. The column value is used by the stored-procedure and then result is shown in the Crystal-Report.
Now my problem is if user checks two CheckBox then the value of both columns should be sent to Crystal-Report page as array. How to implement this
My code behind in GridView page is
protected void ChkCity_CheckedChanged(object sender, EventArgs e)
{
foreach (GridViewRow row in gdCityDetail.Rows)
{
bool ischecked = ((System.Web.UI.WebControls.CheckBox)row.Cells[0].FindControl("CheckBox2")).Checked;
if (ischecked == true)
{
int getrow = Convert.ToInt32(e.CommandArgument);
Label label1 = (Label )gdVilDetail.Rows[getrow].FindControl("label1");
Label label2= (Label )gdVilDetail.Rows[getrow].FindControl("label2");
Response.Redirect("~/crystal report/Landowner.aspx?Yojna=" + label1.text + "&Village=" + label2.text);
}
and the code on .cs page of Crystal-Report is
private void cityreport()
{
SqlCommand Cmd = new SqlCommand("Showvillage", Constr1);
Cmd.CommandType = CommandType.StoredProcedure;
Cmd.Parameters.Add("@Yojna_No", Request.QueryString[0]);
Cmd.Parameters.Add("@Village_Code", Request.QueryString[1]);
DataSet ds = new DataSet();
I think you cannot pass Array or any other Objects through Query string except string values. Rather you can use Session Variable.
Try this..
In page One.
In page Two.
hope it helps..