protected void Page_Load(object sender, EventArgs e) { string userkey = Request.QueryString["userkey"]; questionsWrap.Attributes.Add("userkey", userkey); Guid gu = new Guid(userkey); SQL sql = new SQL(); bool hasTaken = sql.checkIFTaken(gu); if (hasTaken) { string name = sql.CheckCandidate(gu); username.InnerText = "Candidate: " + name; int testId = sql.getTestID(gu); List<questions> list = GetQuestions(testId); foreach (questions q in list) { switch (q.qtype) { case 1: //create textarea StringBuilder sbq = new StringBuilder(); sbq.Append("<div class='well well-small'>"); sbq.Append("<p>" + q.question + "</p>"); sbq.Append("<textarea class='span12' qid='" + q.question_id + "' runat='server' "); sbq.Append("onKeyDown='limitText(this, 2600);' "); sbq.Append("onKeyUp='limitText(this, 2600);' >"); sbq.Append("</textarea></div>"); questionsWrap.InnerHtml += sbq.ToString(); break; case 2: //create true/false StringBuilder sbtf = new StringBuilder(); sbtf.Append("<div class='well well-small'>"); sbtf.Append("<p>" + q.question + "</p>"); sbtf.Append("<select qid='" + q.question_id + "'><option>true</option><option>false</option></select>"); sbtf.Append("</div>"); questionsWrap.InnerHtml += sbtf.ToString(); break; default: //nothing break; } } startTime(gu, DateTime.Now); } else { Response.Redirect("Entry.aspx"); } }