protected void ddlSkillType_SelectedIndexChanged(object sender, EventArgs e) { string ActivityID = DetailsView1.DataKey.Value.ToString(); string Skill1 = "SI_Name,ST_NAME, Skill_Name, VolunteerSkills.V_ID,V_Name, V_LastName,V_MobileNo1, V_MobileNo2,V_Email FROM Volunteer, VolunteerSkills,SkillItems,SkillTypes,Skills WHERE VolunteerSkills.SI_ID = " + ddlSkill.SelectedValue + " AND VolunteerSkills.V_ID = Volunteer.V_ID AND VolunteerSkills.SI_ID = SkillItems.SI_ID AND SkillItems.Skill_ID = Skills.Skill_ID AND Skills.ST_ID = SkillTypes.ST_ID AND VolunteerSkills.V_ID NOT IN (SELECT VolunteerJoinActivities.V_ID FROM VolunteerJoinActivities WHERE Activity_ID = " + ActivityID + ");"; DataTable dtSkill1 = dbconn.QueryExecuteScalar(Skill1); GridViewSkill1.DataSource = dtSkill1; GridViewSkill1.DataBind(); dbconn.Close(); lblSkill1.Text = GridViewSkill1.Rows.Count.ToString(); }
protected void SaveSkill2_Click(object sender, EventArgs e) { CheckBox chkbox = new CheckBox(); foreach (GridViewRow grdRow in GridViewSkill1.Rows) { chkbox = (CheckBox)Convert.ChangeType(((CheckBox)grdRow.FindControl("chk")), typeof(CheckBox)); if (chkbox.Checked) { string keyID = (string)GridViewSkill1.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(); GridViewSkill1.DataBind(); }