protected void Button1_Click(object sender, EventArgs e) { QuestionBankEntities db = new QuestionBankEntities(); FILLINTHEBLANK ft = new FILLINTHEBLANK(); QUESTION qt = new QUESTION(); Label1.Text = qt.QUESTIONTEXT; Label2.Text = ft.ANSWER; // db.QUESTIONS.Where(w => w.ID ).First(); //List<Question> lst = db.Questions.Where(w => w.id > 1 && w.id < 10).ToList(); //Question questiontoFetch = db.Questions.Where(w => w.id == 5).First(); // submit //Label1.Text = f.Question; //Label2.Text = f.Answer; //if (Session["data"] != null) //{ // list = (List<FITB>)Session["data"]; //} //if (f.Question != null && f.Answer != null) //{ // list.Add(f); //} //Session["data"] =list; Button1.Visible = false; }
protected void TextBox2_TextChanged(object sender, EventArgs e) { QuestionBankEntities qb = new QuestionBankEntities(); FILLINTHEBLANK ft = new FILLINTHEBLANK(); int id = (int)(ViewState["data"]); if (TextBox2.Text != null) { ft.ANSWER = TextBox2.Text; TextBox2.Text = ""; } ft.QUESTIONS = id; qb.FILLINTHEBLANKs.Add(ft); qb.SaveChanges(); TextBox1.Visible = false; TextBox2.Visible = false; Label1.Visible = true; Label2.Visible = true; Label3.Visible = false; Label4.Visible = false; }