public static void LoadPageSections() { using (var db = new DB_A14BC3_M3LMSEntities()) { PageSections = (from s in db.ref_pagesection select new Section() { URI = "Home/Index", SectionName = s.Section, Text = s.Text }).ToList(); } }
protected void Button1_Click(object sender, EventArgs e) { DB_A14BC3_M3LMSEntities db = new DB_A14BC3_M3LMSEntities(); var username = Session["UserName"].ToString(); var ltm = db.ref_learnertestmapping.Where(a => a.EmailId == username & a.IsCompleted == false).FirstOrDefault(); Label1.Visible = false; txtName.Visible = false; Button1.Visible = false; Panel1.Visible = true; //lblName.Text = "Name : " + txtName.Text; int score = Convert.ToInt32(txtScore.Text); lblScore.Text = "Score : " + Convert.ToString(score); Session["counter"] = "1"; Random rnd = new Random(); this.qlist = db.ref_TestQ.Where(a => a.TestId == ltm.TestId).Select(a => a.Qid).ToList(); int i = rnd.Next(qlist.Min(), qlist.Max());//Here specify your starting slno of question table and ending no. getQuestion(i); }