protected void Button1_Click(object sender, EventArgs e) { try { SCAnswer scans = new SCAnswer(); scans.SCEmailid = Session["username"] + ""; scans.Scode = Convert.ToInt32(Session["scode"]); scans.studytype = "CTHQ"; scans.SurveyDate = DateTime.Now; se1.SCAnswers.Add(scans); se1.SaveChanges(); SCAnswerDetail scad = new SCAnswerDetail(); scad.sno = scans.sno; //scad.a1 = rb1yes.Checked ? rb1yes.Text : rb1no.Text; //scad.a2 = rb2yes.Checked ? rb2yes.Text : rb2no.Text; //scad.a3 = TextBox32.Text; //scad.a4 = rb4.SelectedItem.Text; //scad.a5 = rb5.SelectedItem.Text; //scad.a6 = rb6y.Checked ? rb6y.Text : rb6n.Text; //scad.a7 = TextBox73.Text; scad.a1 = rb1yes.Checked ? "1" : "0"; scad.a2 = rb2yes.Checked ? "1" : "0"; scad.a3 = rb3yes.Checked ? "1" : "0"; scad.a4 = rb4yes.Checked ? "1" : "0"; scad.a5 = RadioButtonList5.SelectedItem.Value; scad.a6 = CheckBoxList6.SelectedItem.Value; scad.a7 = rb7.SelectedItem.Text; se1.SCAnswerDetails.Add(scad); se1.SaveChanges(); Response.Redirect("SCDashboard.aspx"); } catch (Exception exp) { lblmsg.Text = "sorry for inconvenience :" + exp.ToString(); } }
protected void Button1_Click(object sender, EventArgs e) { SCAnswer scans = new SCAnswer(); scans.SCEmailid = Session["username"] + ""; scans.Scode = Convert.ToInt32(Session["scode"]); scans.studytype = "CTUQ"; scans.SurveyDate = DateTime.Now; se1.SCAnswers.Add(scans); se1.SaveChanges(); SCAnswerDetail scad = new SCAnswerDetail(); scad.sno = scans.sno; //scad.a1 = rb1yes.Checked ? rb1yes.Text : rb1no.Text; //scad.a2 = rb2yes.Checked ? rb2yes.Text : rb2no.Text; //scad.a3 = TextBox32.Text; //scad.a4 = rb4.SelectedItem.Text; //scad.a5 = rb5.SelectedItem.Text; //scad.a6 = rb6y.Checked ? rb6y.Text : rb6n.Text; //scad.a7 = TextBox73.Text; scad.a1 = rb1yes.Checked ? "1" : "0"; scad.a2 = rb2yes.Checked ? "1" : "0"; scad.a3 = rb3yes.Checked ? "1" : "0"; scad.a4 = rb4.SelectedItem.Value; scad.a5 = rb5.SelectedItem.Value; scad.a6 = rb6y.Checked ? "1" : "0"; scad.a7 = rb7y.Checked ? "1" : "0"; scad.a8 = rb8y.Checked ? "1" : "0"; scad.a9 = TextBox93.Text; se1.SCAnswerDetails.Add(scad); se1.SaveChanges(); Response.Redirect("SCDashboard.aspx"); }