2013-01-05 51 views
1

我正在从GridView的数据制作Crystal-ReportGridView有三列,其中两列用来自DataBase的值填充到标签中,第三列有一个CheckBox,它将这两列的值作为查询字符串发送到Crystal-Report的.cs页面。列值由存储过程使用,然后结果显示在Crystal-Report中。 现在我的问题是,如果用户检查两个CheckBox那么两列的值应该作为数组发送到Crystal-Report页面。如何GridView页面后面实现这个如何发送数组中的查询字符串的值

我的代码是

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

      } 

和的.cs的Crystal-Report页上的代码被

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(); 

回答

2

我认为你不能传递数组或任何其他对象通过查询字符串,除字符串值外而是您可以使用会话变量。

试试这个..

在一个页面中。

//Set 
Session["Variable"] = ArrayObj; 

In page two。

//If String[] 

string[] arry = (string[])Session["Variable"]; 

希望它有助于..

相关问题