Exemple #1
0
        /// <summary>
        /// Binds the question data to the rQuestions repeater control.
        /// </summary>
        private void BindRepeater()
        {
            String[,] questionData = DiscService.GetResponsesByQuestion();
            var dataSet   = new DataSet();
            var dataTable = dataSet.Tables.Add();
            var iRow      = questionData.GetLongLength(0);
            var iCol      = questionData.GetLongLength(1);

            dataTable.Columns.Add("r1");   //Response 1
            dataTable.Columns.Add("r2");   //Response 2
            dataTable.Columns.Add("r3");   //Response 3
            dataTable.Columns.Add("r4");   //Response 4
            dataTable.Columns.Add("ms");   //Most Scores
            dataTable.Columns.Add("ls");   //Least Scores

            //Row
            for (var r = 0; r < iRow; r++)
            {
                var row = dataTable.Rows.Add();
                //Column
                for (var c = 0; c < iCol; c++)
                {
                    row[c] = questionData[r, c];
                }
            }

            rQuestions.DataSource = dataSet.Tables[0];
            rQuestions.DataBind();
        }