Click here to Skip to main content
15,662,823 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
dear all,

i want to build an webpage. it will be used as a form to collect some information from user and submit it to be saved on database.

content of the page controls and labels should be created dynamically.

Questions of the form will be read from database. Answers are either free text or multi-choice. Type of the answer will specify the type of the control used to get the answer (textboxes , radioButtons).

should i create controls on page_load or should i create HTML controls using JQUERY on $(document).ready.. ?

choosing between and JQuery will affect next steps, such as validation, collecting controls values and submitting.

any suggestions please? comparison would be appreciated.

thanks in advance
Updated 23-Nov-14 0:30am
Sinisa Hajnal 20-Nov-14 9:02am    
First question: why do you want to create them dynamically?
nina4ever 21-Nov-14 14:06pm    
controls have to be dynamic because QUESTIONS ARE DYNAMIC. they are not the same for all users. Questions will be read from database along with their type (multiple choice , free text...etc) when the page is being loaded, and then i have to create my controls based on questions and their answers (free text queststion needs a textbox, multiple choice question needs radioButtons)
arvind mepani 21-Nov-14 2:29am    
Jquery is best way to handle dynamic content addition and deletion from . at the same time ASP.NET control needs a lots of work like manage newly added control using views state and each and every time need to call code behind function . So Fast and efficient way is you go through jquery.
nina4ever 21-Nov-14 14:10pm    
1- do u know of any example on the internet?
2- is collecting data from controls when submitting the (form) easy?

the problem is that i haven't built anything similar before, so i need opinions of experts before starting.
thank u for ur opinion

1 solution

Share this answer
nina4ever 21-Nov-14 14:48pm    
thank you. i have already tried these in previous projects. i have created some controls using JQUERY based on user actions.
the difference here in the new project is that i don't previously know what controls will be created, and all controls are dynamic. Do u think JQUERY is easier and more effecient than ASP.NET for collecting values and submitting the form?
arvind mepani 21-Nov-14 23:36pm    
First you Need to try this solution without trying you want all answer. how it is possible ?
nina4ever 23-Nov-14 6:00am    
i am sorry, i think i was misunderstood. i said : i HAVE TRIED them :)
thank you for your concern
nina4ever 23-Nov-14 6:34am    
questions, choices and labels that will be displayed on the form have to be read from database. is it efficient to use $ajax inside $(document).ready to retrieve all that information, and then build controls on success based on returned data?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900