Grid style Q and A

Oct 31, 2008 at 11:50 PM
Hi,
I am very impressed with your project. i am still reading on and try to understand the process. However, I have a question regarding your toolkit. Is it possible to have questions and answers as grid?
for example: How often do you read the following newspaper?
                              A ---> Every day                every week                every month                not at all
Q
The Sun
The times
Gaurdian

Thanks,
Kamal
Coordinator
Nov 17, 2008 at 7:41 PM
The best you can do at this stage is specify (for a MCMS question) that the layout be "horizontal"

It's not exactly a grid, but it gets something close to what you indicated in your question.

-sstchur
Mar 19, 2009 at 5:23 PM
Edited Mar 19, 2009 at 8:47 PM
The tweaks to the code listed below will encapsulate each panel of questions in an HTML table with the questions and answers in the same row. The main benefit is with checkboxes and radio buttons which will otherwise always start on its own new line.

Hope this helps,
Matt82

WebQuestion.cs

        private void CreateWebSurveyControls(XmlNodeList _groups)
                ...
                // added line below above inner nested foreach loop
                panel.Controls.Add(new LiteralControl("<table border=1 >"));

                foreach (XmlNode node2 in node.SelectNodes("*"))
                {
                    panel.Controls.Add(this.CreateWebSurveyControl(node2));
                }
                // added line below below inner nested foreach loop
                panel.Controls.Add(new LiteralControl("</table>"));
                ...

WebQuestion.cs
        protected WebQuestion(string strId, string strType, bool bRequired, string strRequiredText, string strQuestion)
        { 
            // added line below at start of method
            this.Controls.Add(new LiteralControl("<tr  ><td align=left >"));
            ...
            // commented out line below near end of method
            //this.Controls.Add(new LiteralControl("<br>"));

            // added line below near end of method
            this.Controls.Add(new LiteralControl("</td><td>"));
         }

ShortAnsWebQuestions.cs
        public ShortAnsWebQuestion(string strId, bool bRequired, string strRequiredText, string strQuestion, int nCols) : base(strId, "shortans", bRequired, strRequiredText, strQuestion)
            ...
            // added line below near end of method
            this.Controls.Add(new LiteralControl("</td></tr>"));

            this.Controls.Add(new LiteralControl("</p>"));
        }

EassyWebQuestions.cs
        public EssayWebQuestion(string strId, bool bRequired, string strRequiredText, string strQuestion, int nRows, int nCols) : base(strId, "shortans", bRequired, strRequiredText, strQuestion)
            ...
            // added line below near end of method
            this.Controls.Add(new LiteralControl("</td></tr>"));

            this.Controls.Add(new LiteralControl("</p>"));
        }

McmsWebQuestions.cs
        public McmsWebQuestion(string strId, bool bRequired, string strRequiredText, string strQuestion, string strControlBase, RepeatDirection rdLayout, string[] strResponses) : base(strId, "mcms", bRequired, strRequiredText, strQuestion)
            ...
            // added line below near end of method
            this.Controls.Add(new LiteralControl("</td></tr>"));

            this.Controls.Add(new LiteralControl("</p>"));
        }

McssWebQuestions.cs
        public McssWebQuestion(string strId, bool bRequired, string strRequiredText, string strQuestion, string strControlBase, RepeatDirection rdLayout, string[] strResponses) : base(strId, "mcms", bRequired, strRequiredText, strQuestion)
            ...
            // added line below near end of method
            this.Controls.Add(new LiteralControl("</td></tr>"));

            this.Controls.Add(new LiteralControl("</p>"));
        }