//to get the camper answers from the database void getCamperAnswers() { string strFilter, strFJCID, strModifiedBy; DataSet dsAnswers; DataView dv; RadioButtonList rb; //DataRow dr; DataRow[] drows; HiddenField hdnval; DropDownList ddl; TextBox tb; strFJCID = hdnFJCID.Value; strModifiedBy = Master.UserId; if (!strFJCID.Equals(string.Empty)) { dsAnswers = CamperAppl.getCamperAnswers(strFJCID, "3", "32", "N"); if (dsAnswers.Tables[0].Rows.Count > 0) //if there are records for the current FJCID { dv = dsAnswers.Tables[0].DefaultView; //to display answers for the Questions 3 -11 for (int i = 3; i <= 11; i++) { //to get the QuestionId for the Questions hdnval = (HiddenField)PnlHidden.FindControl("hdnQ" + i.ToString() + "Id"); strFilter = "QuestionId = '" + hdnval.Value + "'"; tb = null; ddl = null; rb = null; switch (i) { case 3: //assigning the answer for question 3 rb = (RadioButtonList)Panel2.FindControl("RadioBtnQ" + i.ToString()); goto default; case 4: // assigning the answer for question 4 rb = (RadioButtonList)Panel2.FindControl("RadioBtnQ" + i.ToString()); goto default; case 5: // assigning the answer for question 5 rb = (RadioButtonList)Panel2.FindControl("RadioBtnQ" + i.ToString()); goto default; case 6: // assigning the answer for question 6 ddl = ddlGrade; goto default; case 7: // assigning the answer for question 7 //rb = (RadioButtonList)Panel2.FindControl("RadioBtnQ" + i.ToString()); //goto default; foreach (DataRow dr1 in dv.Table.Select(strFilter)) { if (!dr1["OptionID"].Equals(DBNull.Value)) { int value = Convert.ToInt32(dr1["OptionID"].ToString()); switch (value) { case 2: { chkNo.Checked = true; Pnl9a.Enabled = Pnl10a.Enabled = false; break; } case 1: { chkSynagogue.Checked = true; Pnl9a.Enabled = true; break; } case 3: { chkJCC.Checked = Pnl10a.Enabled = true; break; } default: chkNo.Checked = false; break; } } } break; case 8: // assigning the answer for question 8 foreach (DataRow dr in dv.Table.Select(strFilter)) { if (!dr["OptionID"].Equals(DBNull.Value)) { if (dr["OptionID"].ToString().Equals("1")) { ddlSynagogue.SelectedValue = dr["Answer"] != DBNull.Value ? dr["Answer"].ToString() : "0"; } else if (dr["OptionID"].ToString().Equals("2")) { txtOtherSynagogue.Text = dr["Answer"] != DBNull.Value ? dr["Answer"].ToString() : string.Empty; } } } drows = dv.Table.Select(strFilter); if (drows.Length > 0) //if there are rows for the filter { //dr = (DataRow)drows.GetValue(0); foreach (DataRow dr1 in drows) { if (!dr1["OptionID"].Equals(DBNull.Value)) { if (dr1["OptionID"].ToString().Equals("3")) { if (!dr1["Answer"].Equals(DBNull.Value)) { ddlJCC.SelectedValue = dr1["Answer"].ToString(); } } } if (!dr1["OptionID"].Equals(DBNull.Value)) { if (dr1["OptionID"].ToString().Equals("4")) { if (!dr1["Answer"].Equals(DBNull.Value)) { txtJCC.Text = dr1["Answer"].ToString(); } } } } } goto default; case 9: // assigning the answer for question 11 tb = txtSynagogueReferral; goto default; case 10: // assigning the answer for question 9 rb = (RadioButtonList)Panel2.FindControl("RadioBtnQ9"); goto default; case 11: // assigning the answer for question 11 tb = txtCamperSchool; goto default; default: //to implement the common logic drows = dv.Table.Select(strFilter); if (drows.Length > 0) //if there are rows for the filter { foreach (DataRow dr in drows) //dr = (DataRow)drows.GetValue(0); { //for dropdownlist if (ddl != null) { if (ddl == ddlGrade) //for the grade question the value is stored in "Answer" { if (!dr["Answer"].Equals(DBNull.Value)) { ddl.SelectedValue = dr["Answer"].ToString(); } } else if (!dr["OptionID"].Equals(DBNull.Value)) { ddl.SelectedValue = dr["OptionID"].ToString(); } } //for text box if (tb != null) { if (!dr["Answer"].Equals(DBNull.Value) && tb.ClientID != "txtOtherSynagogue") { tb.Text = dr["Answer"].ToString(); } } //for radio buttonlist if (rb != null) { if (!dr["OptionID"].Equals(DBNull.Value)) { rb.SelectedValue = dr["OptionID"].ToString(); } } } } break; } } } //to set the status of the panel based on the radio button selected setPanelStatus(); } //end if for null check of fjcid }
//to get the camper answers from the database void getCamperAnswers() { string strFilter, strFJCID, strModifiedBy; DataSet dsAnswers; DataView dv; RadioButtonList rb; DataRow dr; DataRow[] drows; HiddenField hdnval; strFJCID = hdnFJCID.Value; strModifiedBy = Master.UserId; if (!strFJCID.Equals(string.Empty)) { dsAnswers = CamperAppl.getCamperAnswers(strFJCID, "0", "0", "3,13,20"); if (dsAnswers.Tables[0].Rows.Count > 0) //if there are records for the current FJCID { dv = dsAnswers.Tables[0].DefaultView; //to display answers for the Questions 3 -5 for (int i = 3; i <= 5; i++) { //to get the QuestionId for the Questions hdnval = (HiddenField)PnlHidden.FindControl("hdnQ" + i.ToString() + "Id"); strFilter = "QuestionId = '" + hdnval.Value + "'"; rb = null; switch (i) { case 3: //assigning the answer for question 3 rb = RadioBtnQ3; goto default; case 4: // assigning the answer for question 4 rb = RadioBtnQ4; goto default; case 5: // assigning the answer for question 5 rb = RadioBtnQ5; goto default; default: //to implement the common logic drows = dv.Table.Select(strFilter); if (drows.Length > 0) //if there are rows for the filter { dr = (DataRow)drows.GetValue(0); if (rb != null) { if (!dr["OptionID"].Equals(DBNull.Value)) { rb.SelectedValue = dr["OptionID"].ToString(); } } } break; } } } //to set the status of the panel based on the radio button selected setPanelStatus(); } //end if for null check of fjcid }
//to get the camper answers from the database void getCamperAnswers() { DataSet dsAnswers; DataView dv; RadioButtonList rb; DropDownList ddl; DataRow[] drows; DataRow dr1; HiddenField hdnval; string strFilter, strFJCID, strModifiedBy; strFJCID = hdnFJCID.Value; strModifiedBy = Master.UserId; if (!strFJCID.Equals(string.Empty)) { dsAnswers = CamperAppl.getCamperAnswers(strFJCID, "9", "12", "N"); if (dsAnswers.Tables[0].Rows.Count > 0) //if there are records for the current FJCID { dv = dsAnswers.Tables[0].DefaultView; //to display answers for the QuestionId from 6 - 9 for (int i = 6; i <= 9; i++) { //to get the QuestionId for the Questions hdnval = (HiddenField)PnlHidden.FindControl("hdnQ" + i.ToString() + "Id"); strFilter = "QuestionId = '" + hdnval.Value + "'"; rb = null; ddl = null; switch (i) { case 6: //assigning the answer for question 6 rb = RadioBtnQ6; goto default; case 7: // assigning the answer for question 7 ddl = ddlCamp; goto default; case 8: // assigning the answer for question 8 foreach (DataRow dr in dv.Table.Select(strFilter)) { if (!dr["Answer"].Equals(DBNull.Value)) { txtCampSession.Text = dr["Answer"].ToString(); } } break; //ddl = ddlCampSession; //getCampSession(ddlCamp.SelectedValue); //goto default; case 9: // assigning the answer for question 9 foreach (DataRow dr in dv.Table.Select(strFilter)) { if (!dr["OptionID"].Equals(DBNull.Value)) { switch (dr["OptionID"].ToString()) { case "1": //for Start Date //lblStartDate.Text = dr["Answer"].Equals(DBNull.Value) ? "" : dr["Answer"].ToString(); txtStartDate.Text = dr["Answer"].Equals(DBNull.Value) ? "" : dr["Answer"].ToString(); break; case "2": //for End Date //lblEndDate.Text = dr["Answer"].Equals(DBNull.Value) ? "" : dr["Answer"].ToString(); txtEndDate.Text = dr["Answer"].Equals(DBNull.Value) ? "" : dr["Answer"].ToString(); break; } } } break; default: //to implement the common logic drows = dv.Table.Select(strFilter); if (drows.Length > 0) //if there are rows for the filter { dr1 = (DataRow)drows.GetValue(0); if (rb != null) { if (!dr1["OptionID"].Equals(DBNull.Value)) { rb.SelectedValue = dr1["OptionID"].ToString(); } } if (ddl != null) { if (!dr1["OptionID"].Equals(DBNull.Value)) { ddl.SelectedValue = dr1["OptionID"].ToString(); } } } break; } } } } //end if for null check of fjcid }
//to get the camper answers from the database void getCamperAnswers() { int iCount; DataView dv; HiddenField hdnval; DataRow[] drows; DataRow dr; TextBox tb; RadioButtonList rb; DropDownList ddl; CheckBoxList cb; string strFilter, strFJCID; strFJCID = hdnFJCID_OtherInfo.Value; DataSet dsAnswers = CamperAppl.getCamperAnswers(strFJCID, "30", "1026", "N"); if (dsAnswers.Tables[0].Rows.Count == 0) //if there are records for the current FJCID { return; } dv = dsAnswers.Tables[0].DefaultView; //to display answers for the QuestionId from 1001 - 1004 in Other info page for (int i = 1; i <= 15; i++) { //to get the QuestionId for the Questions hdnval = (HiddenField)PnlHidden.FindControl("hdnQ" + i.ToString() + "Id"); strFilter = "QuestionId = '" + hdnval.Value + "'"; rb = null; tb = null; ddl = null; iCount = dsAnswers.Tables[0].Rows.Count; switch (i) { case 1: //assigning the answer for question 1 rb = RadioBtnQ1; goto default; case 2: //assigning the answer for question 2 tb = txtSynagogue; goto default; case 3: //assigning the answer for question 3 rb = RadioBtnQ3; goto default; case 4: //assigning the answer for question 4 rb = RadioBtnQ4; goto default; case 5: //assigning the answer for question 5 rb = RadioBtnQ5; goto default; case 6: //assigning the answer for question 6 foreach (DataRow dr1 in dv.Table.Select(strFilter)) { if (!dr1["OptionID"].Equals(DBNull.Value)) { switch (dr1["OptionID"].ToString()) { case "1": //for Parent 1 Country //txtCountry1.Text = dr1["Answer"].Equals(DBNull.Value) ? "" : dr1["Answer"].ToString(); if (!dr1["Answer"].Equals(DBNull.Value)) { ddlCountry1.SelectedValue = dr1["Answer"].ToString(); } break; case "2": //for End Date //txtCountry2.Text = dr1["Answer"].Equals(DBNull.Value) ? "" : dr1["Answer"].ToString(); if (!dr1["Answer"].Equals(DBNull.Value)) { ddlCountry2.SelectedValue = dr1["Answer"].ToString(); } break; } } } break; case 7: //assigning the answer for question 7 // rb = RadioBtnQ7; // goto default; case 8: //assigning the answer for question 8 ddl = ddlQ8; goto default; case 9: //assigning the answer for question 9 //ddl = ddlQ9; //goto default; foreach (DataRow dr1 in dv.Table.Select(strFilter)) { if (!dr1["OptionID"].Equals(DBNull.Value)) { int value = Convert.ToInt32(dr1["OptionID"].ToString()); if (value > 0) { chkQ9.Items.FindByValue(value.ToString()).Selected = true; } } } break; case 10: //assigning the answer for question 10 foreach (DataRow dr1 in dv.Table.Select(strFilter)) { if (!dr1["OptionID"].Equals(DBNull.Value)) { int value = Convert.ToInt32(dr1["OptionID"].ToString()); if (value > 0) { chkQ10.Items.FindByValue(value.ToString()).Selected = true; } } } break; case 11: //assigning the answer for question 11 // rb = RadioBtnQ11; // goto default; case 12: //assigning the answer for question 12 // rb = RadioBtnQ12; // goto default; case 13: //assigning the answer for question 13 dv.RowFilter = strFilter; if (dv.Table.Select(strFilter).Length > 0) { div_dtlist.Visible = true; dlInviteFriends.Visible = true; dlInviteFriends.DataSource = dv; dlInviteFriends.DataBind(); } break; case 14: //assigning the answer for question 2 foreach (DataRow dr1 in dv.Table.Select(strFilter)) { //if (!dr1["OptionID"].Equals(DBNull.Value)) //{ //if (dr1["OptionID"].ToString().Equals("4")) //{ if (!dr1["Answer"].Equals(DBNull.Value)) { txtJCC.Text = dr1["Answer"].ToString(); } //} //} } break; case 15: //assigning the answer for question 5 rb = RadioBtnQ6; goto default; default: drows = dv.Table.Select(strFilter); if (drows.Length > 0) //if there are rows for the filter { dr = (DataRow)drows.GetValue(0); //for dropdownlist if (ddl != null) { if (!dr["OptionID"].Equals(DBNull.Value)) { ddl.SelectedValue = dr["OptionID"].ToString(); } } //for text box if (tb != null) { if (!dr["Answer"].Equals(DBNull.Value)) { tb.Text = dr["Answer"].ToString(); } } //for radio buttonlist if (rb != null) { if (!dr["OptionID"].Equals(DBNull.Value)) { rb.SelectedValue = dr["OptionID"].ToString(); } } } break; } } DataSet dsSynagogues = new DataSet(); DataSet DsJcc = new DataSet(); for (int i = 0; i < dsAnswers.Tables[0].Rows.Count; i++) { if (dsAnswers.Tables[0].Rows[i][1].ToString() != null) { if ((dsAnswers.Tables[0].Rows[i][1].ToString() == "30")) { if (RadioBtnQ1.SelectedValue == "") { RadioBtnQ1.SelectedValue = "2"; } if (RadioBtnQ4.SelectedValue == "") { RadioBtnQ4.SelectedValue = "2"; } } if ((dsAnswers.Tables[0].Rows[i][1].ToString() == "30") && ((SynagogueJCCOther)Convert.ToInt32(dsAnswers.Tables[0].Rows[i][2]) == SynagogueJCCOther.Other)) { RadioBtnQ1.SelectedValue = "2"; RadioBtnQ4.SelectedValue = "2"; RadioBtnQ1.Enabled = false; RadioBtnQ4.Enabled = false; txtSynagogue.Enabled = false; txtJCC.Enabled = false; txtSynagogue.Text = ""; txtJCC.Text = ""; break; } else if ((dsAnswers.Tables[0].Rows[i][1].ToString() == "30") && ((SynagogueJCCOther)Convert.ToInt32(dsAnswers.Tables[0].Rows[i][2]) == SynagogueJCCOther.Synagogue)) { RadioBtnQ1.SelectedValue = "1"; RadioBtnQ1.Enabled = false; txtJCC.Enabled = false; } else if ((dsAnswers.Tables[0].Rows[i][1].ToString() == "30") && ((SynagogueJCCOther)Convert.ToInt32(dsAnswers.Tables[0].Rows[i][2]) == SynagogueJCCOther.JCC)) { RadioBtnQ4.SelectedValue = "1"; RadioBtnQ4.Enabled = false; txtSynagogue.Enabled = false; } if (dsAnswers.Tables[0].Rows[i][1].ToString() == "31") { if ((dsAnswers.Tables[0].Rows[i][2].ToString() == "1")) { if ((dsAnswers.Tables[0].Rows[i][3].ToString() != null) && (dsAnswers.Tables[0].Rows[i][3].ToString().Trim() != "")) { int federationID = Convert.ToInt32(Session["FedId"].ToString()); dsSynagogues = objGeneral.GetSynagogueByID(dsAnswers.Tables[0].Rows[i][3].ToString(), federationID); if (dsSynagogues.Tables[0].Rows.Count > 0) { txtSynagogue.Text = dsSynagogues.Tables[0].Rows[0][1].ToString(); txtSynagogue.Enabled = false; } } } if ((dsAnswers.Tables[0].Rows[i][2].ToString() == "2")) { if ((dsAnswers.Tables[0].Rows[i][3].ToString() != null) && (dsAnswers.Tables[0].Rows[i][3].ToString().Trim() != "")) { txtSynagogue.Text = dsAnswers.Tables[0].Rows[i][3].ToString(); txtSynagogue.Enabled = false; } } if ((dsAnswers.Tables[0].Rows[i][2].ToString() == "3")) { if ((dsAnswers.Tables[0].Rows[i][3].ToString() != null) && (dsAnswers.Tables[0].Rows[i][3].ToString().Trim() != "")) { DsJcc = objGeneral.GetJCCByID(dsAnswers.Tables[0].Rows[i][3].ToString()); txtJCC.Text = DsJcc.Tables[0].Rows[0][1].ToString(); txtJCC.Enabled = false; } } if ((dsAnswers.Tables[0].Rows[i][2].ToString() == "4")) { if ((dsAnswers.Tables[0].Rows[i][3].ToString() != null) && (dsAnswers.Tables[0].Rows[i][3].ToString().Trim() != "")) { txtJCC.Text = dsAnswers.Tables[0].Rows[i][3].ToString(); txtJCC.Enabled = false; } } } } } DataSet dsTerms = CamperAppl.getCamperApplication(strFJCID); if (dsTerms.Tables[0].Rows.Count > 0) { dr = dsTerms.Tables[0].Rows[0]; if (!dr["ConfirmAcceptance"].Equals(DBNull.Value)) { chkAgreement.Checked = (Boolean)dr["ConfirmAcceptance"]; } } //to set the panel status based on the radio button selected setPanelStatus(); }
//to get the camper answers from the database void getCamperAnswers() { string strFilter, strFJCID, strModifiedBy; DataSet dsAnswers; DataView dv; RadioButtonList rb; DataRow dr; DataRow[] drows; HiddenField hdnval; DropDownList ddl; TextBox tb; DataSet dsSchool = new DataSet(); strFJCID = hdnFJCID.Value; strModifiedBy = Master.UserId; if (!strFJCID.Equals(string.Empty)) { dsAnswers = CamperAppl.getCamperAnswers(strFJCID, "3", "33", "N"); if (dsAnswers.Tables[0].Rows.Count > 0) //if there are records for the current FJCID { dv = dsAnswers.Tables[0].DefaultView; //to display answers for the Questions 3 -11 for (int i = 3; i <= 9; i++) { //to get the QuestionId for the Questions hdnval = (HiddenField)PnlHidden.FindControl("hdnQ" + i.ToString() + "Id"); strFilter = "QuestionId = '" + hdnval.Value + "'"; tb = null; ddl = null; rb = null; switch (i) { case 3: //assigning the answer for question 3 rb = (RadioButtonList)Panel2.FindControl("RadioBtnQ" + i.ToString()); goto default; case 4: // assigning the answer for question 4 rb = (RadioButtonList)Panel2.FindControl("RadioBtnQ" + i.ToString()); goto default; case 5: // assigning the answer for question 5 rb = (RadioButtonList)Panel2.FindControl("RadioBtnQ" + i.ToString()); goto default; case 6: // assigning the answer for question 6 ddl = ddlGrade; goto default; case 7: // assigning the answer for question 9 rb = (RadioButtonList)Panel2.FindControl("RadioBtnQ9"); goto default; case 8: // assigning the answer for question 10 //ddl = ddlQ10; //tb = txtJewishSchool; goto default; case 9: // assigning the answer for question 11 tb = txtCamperSchool; goto default; default: //to implement the common logic drows = dv.Table.Select(strFilter); int intSchool; if (drows.Length > 0) //if there are rows for the filter { dr = (DataRow)drows.GetValue(0); if (!dr["OptionID"].Equals(DBNull.Value)) { if (!dr["Answer"].Equals(DBNull.Value)) { Int32.TryParse(dr["Answer"].ToString(), out intSchool); if (intSchool > 0) { dsSchool = CamperAppl.GetSchool(intSchool); dr = (DataRow)dsSchool.Tables[0].Rows[0]; } else if (intSchool == -1) { if (drows.Length > 1) { dr = (DataRow)drows.GetValue(1); } } } } //for dropdownlist if (ddl != null) { if (ddl == ddlGrade) //for the grade question the value is stored in "Answer" { if (!dr["Answer"].Equals(DBNull.Value)) { ddl.SelectedValue = dr["Answer"].ToString(); } } else if (!dr["OptionID"].Equals(DBNull.Value)) { ddl.SelectedValue = dr["OptionID"].ToString(); } } //for text box if (tb != null) { if (!dr["Answer"].Equals(DBNull.Value)) { tb.Text = dr["Answer"].ToString(); } } //for radio buttonlist if (rb != null) { if (!dr["OptionID"].Equals(DBNull.Value)) { rb.SelectedValue = dr["OptionID"].ToString(); } } } break; } } } //to set the status of the panel based on the radio button selected setPanelStatus(); } //end if for null check of fjcid }
//to get the camper answers from the database void getCamperAnswers() { DataSet dsAnswers, dsAcknowledge; int iCount; DataView dv; RadioButton rb; TextBox tb; DropDownList ddl; HiddenField hdnval; DataRow dr1; DataRow[] drows; string strFilter, strFJCID, strModifiedBy; strFJCID = hdnFJCID.Value; strModifiedBy = Master.UserId; if (!strFJCID.Equals(string.Empty)) { dsAnswers = CamperAppl.getCamperAnswers(strFJCID, "9", "12", "N"); //to set the acknowledgement flag by getting the value from the database dsAcknowledge = CamperAppl.getCamperApplication(strFJCID); if (dsAcknowledge.Tables[0].Rows.Count > 0) { if (!dsAcknowledge.Tables[0].Rows[0]["confirm4"].Equals(DBNull.Value)) { chkAcknowledgement.Checked = (Boolean)dsAcknowledge.Tables[0].Rows[0]["confirm4"]; } } //end of setting the acknowledgement flag if (dsAnswers.Tables[0].Rows.Count > 0) //if there are records for the current FJCID { dv = dsAnswers.Tables[0].DefaultView; //to display answers for the QuestionId from 6 - 9 for (int i = 7; i <= 10; i++) { //to get the QuestionId for the Questions hdnval = (HiddenField)PnlHidden.FindControl("hdnQ" + i.ToString() + "Id"); strFilter = "QuestionId = '" + hdnval.Value + "'"; iCount = dsAnswers.Tables[0].Rows.Count; tb = null; rb = null; ddl = null; switch (i) { case 7: //assigning the answer for question 7 foreach (DataRow dr in dv.Table.Select(strFilter)) { if (!dr["OptionID"].Equals(DBNull.Value)) { //rb = (RadioButton)Panel2.FindControl("RadioButtonQ7Option" + dr["OptionID"].ToString()); //rb.Checked = true; rb = (RadioButton)RegControls1.FindControl("RadioButtonQ7Option" + dr["OptionID"].ToString()); rb.Checked = true; } } break; case 8: // assigning the answer for question 8 ddl = ddlCamp; goto default; case 9: // assigning the answer for question 9 foreach (DataRow dr in dv.Table.Select(strFilter)) { if (!dr["Answer"].Equals(DBNull.Value)) { txtCampSession.Text = dr["Answer"].ToString(); } } break; //ddl = ddlCampSession; //getCampSession(ddlCamp.SelectedValue); //goto default; case 10: // assigning the answer for question 10 foreach (DataRow dr in dv.Table.Select(strFilter)) { if (!dr["OptionID"].Equals(DBNull.Value)) { switch (dr["OptionID"].ToString()) { case "1": //for Start Date //lblStartDate.Text = dr["Answer"].Equals(DBNull.Value) ? "" : dr["Answer"].ToString(); txtStartDate.Text = dr["Answer"].Equals(DBNull.Value) ? "" : dr["Answer"].ToString(); break; case "2": //for End Date //lblEndDate.Text = dr["Answer"].Equals(DBNull.Value) ? "" : dr["Answer"].ToString(); txtEndDate.Text = dr["Answer"].Equals(DBNull.Value) ? "" : dr["Answer"].ToString(); break; } } /*if (!dr["OptionID"].Equals(DBNull.Value)) * { * switch (dr["OptionID"].ToString()) * { * case "1": //for Start Date * //txtStartDate.Text = dr["Answer"].Equals(DBNull.Value) ? "" : dr["Answer"].ToString(); * break; * case "2": //for End Date * //txtEndDate.Text = dr["Answer"].Equals(DBNull.Value) ? "" : dr["Answer"].ToString(); * break; * } * }*/ } break; default: //to implement the common logic drows = dv.Table.Select(strFilter); if (drows.Length > 0) //if there are rows for the filter { dr1 = (DataRow)drows.GetValue(0); if (ddl != null) { if (!dr1["OptionID"].Equals(DBNull.Value)) { ddl.SelectedValue = dr1["OptionID"].ToString(); } } /*if (tb != null) * { * if (!dr1["Answer"].Equals(DBNull.Value)) * tb.Text = dr1["Answer"].ToString(); * }*/ } break; } } } } //end if for null check of fjcid }