What is the best control to show different types of questions?

3 posts, 0 answers
  1. ms
    ms avatar
    5 posts
    Member since:
    May 2008

    Posted 07 Nov 2008 Link to this post

    Hi Guys,
                   I have a scenario where I want to show a set of questions in which each questions is of different type say Single selection (radio btn),Multiple choice (chkbox), Text, Ranking etc. I want to show them in a single page and collect the information in onclick. Can some one suggest me best possible control or way of doing this?

    Things that I have tried

    1) In RadGrid with one colum and having diffenrent type of UI in panels  inside Templatecolum. And manipulating the visibility of the each panel in ItemCreated and ItemBound events for different type of questions coming from the data. That is my gird in aspx look like this


    <MasterTableView Width="70%" AutoGenerateColumns="False" NoMasterRecordsText="No Product Exists">






        <telerik:GridTemplateColumn UniqueName="Question">






                    <asp:Panel ID="pnlSimpleTxt" runat="server" BackColor="Aqua" Height="50px" Width="125px">



                            <asp:Literal ID="Question1" runat="server"></asp:Literal>



                            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>






                   <asp:Panel ID="pnlMultiChoice" runat="server" BackColor="Bisque" Height="50px" Width="125px">



                            <asp:Literal ID="Question2" runat="server"></asp:Literal>



                            <asp:CheckBox ID="CheckBox1" runat="server" />
                            <asp:CheckBox ID="CheckBox2" runat="server" />






                    <asp:Panel ID="pnlSingleSelect" runat="server" Height="50px" Width="125px">



                            <asp:Literal ID="Question3" runat="server"></asp:Literal>



                            <asp:DropDownList ID="ddlAnswerOptions" runat="server">




















    Though it is working, I am not ok with this crude way of doing it.  Is there any other good solution for this?

    Thanks for you help !!

  2. Shaun Peet
    Shaun Peet avatar
    571 posts
    Member since:
    Aug 2004

    Posted 07 Nov 2008 Link to this post

    I think you've got the right idea, but I'm not sure why you're wrapping this inside of a RadGrid.  You could use the same technique for a FormView or a ListView control, or even a standard Panel.  Essentially you'll have a template for each type of question and then show/hide the templates as needed, binding to data as needed for possible lists of answers.

    If you're looking for completely new ideas, what I'd do in your case is actually generate the entire html code on the server, complete with the form elements, rendering a string to the page and using client-script to capture the answer and send it back to the server.  This would not be easy to do but would be fast.  Using web services + ajax to generate the question and to capture the answer would be extremely fast.

  3. ms
    ms avatar
    5 posts
    Member since:
    May 2008

    Posted 11 Nov 2008 Link to this post

    Hi Shaun,
                  Thanks for your prompt response and sorry I was on vacation and unable to respond earlier.  Formview may not be the right control as I need to show all questions at a time, Listview may be the right control. But what you've suggested as third option seems great  (generate entire controls on server) , i can make up to " rendering a string to the page"  but could you explain a bit more on "using client-script to capture the answer and send it back to the server" any link to explain this would be great.

    Thanks a lot
Back to Top