Example #1
0
        protected void GoToPart3Button_Click(object sender, EventArgs e)
        {
            DataView dv = (DataView)ReadingTextSqlDataSource.Select(DataSourceSelectArguments.Empty);

            ReadingTextTitle.Text = dv.Table.Rows[0]["Title"].ToString();
            ReadingTextId         = Int32.Parse(dv.Table.Rows[0]["Id"].ToString());

            StudentReadingAnswerSqlDataSource.Delete();

            StudentExamReading = (DataView)StudentReadingAnswerSqlDataSource.Select(DataSourceSelectArguments.Empty);


            if (StudentExamReading.Table.Rows.Count == 0)
            {
                dv = (DataView)ExamQuestionsSqlDataSource.Select(DataSourceSelectArguments.Empty);
                foreach (DataRow row in dv.Table.Rows)
                {
                    QuestionOrder = Int32.Parse(row["RowNumber"].ToString());
                    QuestionId    = Int32.Parse(row["Id"].ToString());
                    StudentReadingAnswerSqlDataSource.Insert();
                }
                StudentExamReading = (DataView)StudentReadingAnswerSqlDataSource.Select(DataSourceSelectArguments.Empty);
            }

            ButtonsRepeater.DataSource = StudentExamReading;
            ButtonsRepeater.DataBind();
            QuestionsRepeater.DataSource = StudentExamReading;
            QuestionsRepeater.DataBind();
            ShowQuestion(1);
            ActivateWizardStep(3);
            SetVisiblePanel(TestPanels.Part3Panel);
        }
Example #2
0
        protected void ShowQuestion(int questionNo)
        {
            questionNo--;
            StudentExamReading = (DataView)StudentReadingAnswerSqlDataSource.Select(DataSourceSelectArguments.Empty);


            if (StudentExamReading == null)
            {
                DataView dv = (DataView)ExamQuestionsSqlDataSource.Select(DataSourceSelectArguments.Empty);
                foreach (DataRow row in dv.Table.Rows)
                {
                    QuestionOrder = Int32.Parse(row["RowNumber"].ToString());
                    QuestionId    = Int32.Parse(row["Id"].ToString());
                    StudentReadingAnswerSqlDataSource.Insert();
                }
                StudentExamReading = (DataView)StudentReadingAnswerSqlDataSource.Select(DataSourceSelectArguments.Empty);
            }

            ButtonsRepeater.DataSource = StudentExamReading;
            ButtonsRepeater.DataBind();
            QuestionsRepeater.DataSource = StudentExamReading;
            QuestionsRepeater.DataBind();
            for (int i = 0; i < QuestionsRepeater.Items.Count; i++)
            {
                if (i == questionNo)
                {
                    QuestionsRepeater.Items[i].Visible = true;
                }
                else
                {
                    QuestionsRepeater.Items[i].Visible = false;
                }
            }
        }
Example #3
0
 protected void QuestionsRepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "validateAnswer")
     {
         RadioButtonList rblChoices = e.Item.FindControl("RadioButtonList1") as RadioButtonList;
         //DataRowView data = (DataRowView)e.Item.DataItem;
         Label ResultLabel = e.Item.FindControl("ResultLabel") as Label;
         QuestionId    = Int32.Parse((e.Item.FindControl("HiddenQuestionID") as HiddenField).Value);
         QuestionOrder = Int32.Parse((e.Item.FindControl("HiddenQuestionOrder") as HiddenField).Value);
         StudentAnswer = rblChoices.SelectedItem.Value;
         StudentReadingAnswerSqlDataSource.Update();
         //QuestionId = Int32.Parse(data.Row["OptionA"].ToString());
         //QuestionOrder = Int32.Parse(data.Row["OptionA"].ToString());
         //Answer
         //QuestionsRepeater.DataSource = (DataView)StudentReadingAnswerSqlDataSource.Select(DataSourceSelectArguments.Empty);
         //QuestionsRepeater.DataBind();
         ShowQuestion(e.Item.ItemIndex + 1);
     }
 }