protected void OnOK(object sender, EventArgs e) { //Event handler for export button clicked // Session["LoadTenders"] = null; if (this.grdTenders.DataKeys.Count > 0) { //Get parameters for the query string _load = ""; string client = this.cboClient.SelectedValue; DateTime start = this.ddpTenders.FromDate; DateTime end = this.ddpTenders.ToDate; EnterpriseService enterprise = new EnterpriseService(); LoadTenderDS ds = new LoadTenderDS(); LoadTenderDS _ds = enterprise.GetLoadTenders(client, start, end); foreach (GridViewRow row in SelectedRows) { DataKey dataKey = (DataKey)this.grdTenders.DataKeys[row.RowIndex]; _load = dataKey["Load"].ToString(); ds.Merge(_ds.Tables[EnterpriseService.TBL_LOADTENDERS].Select("Load='" + _load + "'")); } Session["LoadTenders"] = ds; Response.Redirect("LoadTender.aspx"); } }