if (Session["tblSelected"] == null){DataColumn actID = new DataColumn("actID");actID.DataType = Type.GetType("System.Int32");tblSelected.Columns.Add(actID);DataColumn actStatus = new DataColumn("actStatus");actStatus.DataType = Type.GetType("System.Int32");tblSelected.Columns.Add(actStatus);DataColumn prodCode = new DataColumn("prodCode");prodCode.DataType = Type.GetType("System.Int32");tblSelected.Columns.Add(prodCode);DataColumn[] pCol = new DataColumn[1];pCol[0] = actID;tblSelected.PrimaryKey = pCol;}else{tblSelected = (DataTable)Session["tblSelected"];Session["tblSelected"] = null;}DataRow dRow = tblSelected.NewRow();dRow["actID"] = activationID;dRow["actStatus"] = activationStatus;dRow["prodCode"] = productCode;if (!tblSelected.Rows.Contains(activationID)){tblSelected.Rows.Add(dRow);}else{tblSelected.Rows.Find(activationID).Delete();}Session["tblSelected"] = tblSelected;
DataTable tblSelected = new DataTable();
foreach (DataRow row in tblSelected.Rows){ // My code that activates the products.... }