private bool fillquestion()//Hämtar frågorna { Classes.clsFillQuestion clFill = new Classes.clsFillQuestion(); try { rbQuestionList.DataTextField = "name"; rbQuestionList.DataValueField = "id"; rbQuestionList.DataSource = clFill.readXML(cmbChooseQue.SelectedValue.ToString(), Server.MapPath("~/questions.xml")); rbQuestionList.DataBind(); } catch (Exception ex) { Label1.Text = ex.ToString(); } return(true); }
public void randomizeTest(string testID) { clsTestMenuFill clMen = new clsTestMenuFill(); DataTable dt = clMen.read(testID); for (int i = 0; i < dt.Rows.Count; i++) { Random rand = new Random((int)DateTime.Now.Ticks); int RandomNumber; RandomNumber = rand.Next(1, 1200) * 1000; dt.Rows[i]["name"] = RandomNumber.ToString(); } dt.DefaultView.Sort = "name"; dt = dt.DefaultView.ToTable(); for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["name"] = (i + 1); } Classes.clsFillQuestion clQue = new Classes.clsFillQuestion(); string xml = clQue.getXml(testID); setValXML(testID, xml); }