Survey Builder - Dynamic Forms

jeffpeters

Member
Joined
Jul 28, 2006
Messages
14
Programming Experience
5-10
Hi

Anyone got any ideas how I can get form objects to appear / disappear in VB.Net 2. I'd previously used javascript and iframes to make additional child questions reveal themselves if appropriate.

For example:

Do you like blue cheese?

If Y then ask child question might appear below.

What about red wine?

etc etc

Thanks in advance

Jeff
 
Ok say you have a page with

a label with its text property "Do you like blue cheese?" and next to it a dropdown list with Yes and No as its items. on a new line you have a label with "What about red wine?" in another label set its visible property to false

then in the selectedindexchanged event of the drop downlist you could put

If DropDownList1.text = "Yes" then
label2.visible = true
end if

I think thats what you're asking for? If not point me in the right direction
 
You can go a step further and instead of executing the postback to the server (refreshing the page) you can use AJAX to post your request and AJAX in return can display your label as Craig suggested. This way you eliminate the refresh of the page on the onchange event.
 
Hi Guys - Thanks for the posts

Unfortunately at design time I do not have the objects on the form, only a placeholder. The labels that display the question text, drop-down-lists of the answers are added at run time from a data source.

I've been thinking of making child questions and their ddl answers invisible or keeping them in a separate placeholder whose height = 0 until required but need to recognise when a parent question has been answered that would necessitate making the child visible again.

Question is how?

If I make each ddl autopostback = true, how can I determine which ddl was pressed. Or indeed is this necessary?

Thanks in advance

jeff
 
Back
Top