Dynamic page Creation ASP and C#

T

Tex

I am trying to build a survey application using asp.net 2.0 and c# in
visual studio 2005. I am fairly new to asp. I need to find a way to
dynamically create a page with all of the survey questions on it. I am
able to gather question names, types, answers etc... However once I
have all of this information I am not sure how to dynamically create
this webpage with different kinds of questions with varying amounts of
answers.

Any help would be appreciated.

Thanks
 
G

Guest

I am trying to build a survey application using asp.net 2.0 and c# in
visual studio 2005. I am fairly new to asp. I need to find a way to
dynamically create a page with all of the survey questions on it. I am
able to gather question names, types, answers etc... However once I
have all of this information I am not sure how to dynamically create
this webpage with different kinds of questions with varying amounts of
answers.


I think you need some basic ASP.NET tutorials:

http://aspnet.4guysfromrolla.com/articles/081402-1.aspx

Basically you need to create the controls dynamically - based on the
contents of your survey.
 
T

Tex

I can add controls dynamically, but since I dont know how many I may
need to add how can I specify a place holder for each. If I don't give
a place holder it just crams verything up next to eachother. I guess I
see how to create the controls but how can I control the layout when I
don't know how many controls I may be adding?


Thanks
 
K

KMA

To space out the controls, put a break in between each (<BR>), for example,
or add CSS info. A key issue is how you handle the postback. You may need to
assign a unique ID to each set of controls so that you can iterate through
them and find out what question they were ansering.
 
G

Guest

If I don't give
a place holder it just crams verything up next to eachother. I guess I
see how to create the controls but how can I control the layout when I
don't know how many controls I may be adding?

You can stuff multiple controls into a place holder.

Or you can do dynamic formatting - i.e. build your table dynamically.

Or you can use a control like a DataGrid, Repeater, or DataList.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top