protected void ddlTT1_SelectedIndexChanged(object sender, EventArgs e) { string ActivityID = DetailsView1.DataKey.Value.ToString(); string TT1 = "SELECT TeamMembers.V_ID, V_Name, V_LastName,V_MobileNo1, V_MobileNo2,V_Email ,TP_Name FROM TeamMembers,TeamPositions,Volunteer WHERE TeamMembers.TT_ID = 4 AND TeamMembers.V_ID = Volunteer.V_ID and TeamMembers.TP_ID = TeamPositions.TP_ID AND TeamMembers.V_ID NOT IN (SELECT VolunteerJoinActivities.V_ID FROM VolunteerJoinActivities WHERE Activity_ID = " + ActivityID + "); "; DataTable dtTT1 = dbconn.QueryExecuteScalar(TT1); GridViewTT1.DataSource = dtTT1; GridViewTT1.DataBind(); dbconn.Close(); lblTT2.Text = GridViewTT1.Rows.Count.ToString(); }
protected void SaveTT2_Click(object sender, EventArgs e) { CheckBox chkbox = new CheckBox(); foreach (GridViewRow grdRow in GridViewTT1.Rows) { chkbox = (CheckBox)Convert.ChangeType(((CheckBox)grdRow.FindControl("chk")), typeof(CheckBox)); if (chkbox.Checked) { string keyID = (string)GridViewTT1.DataKeys[grdRow.RowIndex].Value.ToString(); string sqlSelectVolunteer = "Insert into VolunteerJoinActivities(V_ID,VJA_Status,Activity_ID) Values (" + keyID + ",'Selected'," + DetailsView1.SelectedValue + ") ;"; dbconn.QueryExecuteScalar(sqlSelectVolunteer); } } dbconn.Close(); GridViewTT1.DataBind(); }