Ejemplo n.º 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);
        }
Ejemplo n.º 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;
                }
            }
        }