This is a migrated thread and some comments may be shown as answers.

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

2 Answers 42 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
ms
Top achievements
Rank 1
ms asked on 07 Nov 2008, 09:12 AM
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">

 

 

<Columns>

 

 

    <telerik:GridTemplateColumn UniqueName="Question">

 

 

        <ItemTemplate>

 

 

                <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>

 

 

               <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>

 

 

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

 

 

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

 

 

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

 

 

                        </asp:DropDownList>

 

 

                </asp:Panel>

 

 

        </ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

</Columns>

 

 

</MasterTableView>

 

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 !!
ms

2 Answers, 1 is accepted

Sort by
0
Shaun Peet
Top achievements
Rank 2
answered on 07 Nov 2008, 09:30 PM
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.


0
ms
Top achievements
Rank 1
answered on 12 Nov 2008, 05:26 AM
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
 ms
Tags
General Discussions
Asked by
ms
Top achievements
Rank 1
Answers by
Shaun Peet
Top achievements
Rank 2
ms
Top achievements
Rank 1
Share this question
or