protected void btnMapToCustomer_Click(object sender, EventArgs e) { ArrayList Stagingtableid = new ArrayList(); ArrayList ProcessId = new ArrayList(); int i = 0; const int FOLIONUM_INDEX = 2; HiddenField hdnStagingTableid; HiddenField hdnAMCCode; string folionum; foreach (GridViewRow dr in gvRejectedFolios.Rows) { CheckBox checkBox = (CheckBox)dr.FindControl("chkBxSelFolio"); if (checkBox.Checked) { hdnStagingTableid = (HiddenField)dr.FindControl("hdnBxSelStagingTabId"); Stagingtableid.Add(hdnStagingTableid.Value.ToString()); hdnAMCCode = (HiddenField)dr.FindControl("hdnBxSelAMCCode"); folionum = dr.Cells[FOLIONUM_INDEX].Text; //Get all processid for selected folionum and amc code DataSet dsProcessIds = rejectedRecordsBo.GetUploadProcessIDForSelectedFoliosANDAMC(adviserid, Convert.ToInt32(hdnAMCCode.Value.ToString()), folionum); foreach (DataRow drprocessids in dsProcessIds.Tables[0].Rows) { ProcessId.Add(drprocessids["ProcessId"].ToString()); } //ProcessId.Add(hdnAMCCode.Value.ToString()); i++; } } //use a hashtable to create a unique list Hashtable ht = new Hashtable(); foreach (string item in ProcessId) { //set a key in the hashtable for our arraylist value - leaving the hashtable value empty ht[item] = null; } //now grab the keys from that hashtable into another arraylist ArrayList distincProcessIds = new ArrayList(ht.Keys); //int selectedcount = ProcessId.Count; //string[] processids = new string[selectedcount]; //for(i=0; i<selectedcount; i++) Session["Stagingtableid"] = Stagingtableid; Session["distincProcessIds"] = distincProcessIds; Response.Write("<script type='text/javascript'>detailedresults=window.open('Uploads/MapToCustomers.aspx','mywindow', 'width=700,height=450,scrollbars=yes,location=no');</script>"); }