XModPro

Iterate a grid of items in a Form

Steve A Steve A posted Feb 2, 2016
Active Feb 2 · Viewed 19 times

A client recently asked for a photo quiz with 12 photos and 4 random radio button options for each.

I tried an XMP template first, with a button to "edit" each record and submit an answer. I then tried a multi-page XMP form. Both were rejected because the client wanted a single form with one submit button.

I was able to achieve it with an XMP form and 12 different ControlDataSource commands, each one selecting the TOP 3 random incorrect answers from SQL

To get 4 options, I added the correct answer as a Listitem, and appended the DataSource options to the RadioButtonList with AppendDataboundItems="True".

The display looks nice with a Bootstrap thumbnail grid, and the submitted form redirects to a page with an XMod template that retrieves the user's results with a Stored Procedure.

This works, but now the client wants more items added to the quiz.

Can anyone think of a way to iterate through all of the required data for each question? XMod Data View controls include an "Each" control for iteration, but I couldn't figure out a way to duplicate that in a Form.

Thanks in advance, and I hope the answer isn't terribly obvious. :)

0 Replies

Loading replies...