Question on asp.net user/server controls
Let me start by describing what I need to do:
I am writing an "online questionnaire" page, which needs to display a
variable number of questions (typically 1-5) on screen. Each question
has a number of answers (typically 2-5) in the form of radio buttons.
Upon clicking submit, I need to save the selected answers, then
recursively call the page again to display the next group of
questions, and so on until the end of the questionnaire.
That's about it really. Now it sounds to me like one solution is to
have some kind of "Question" control (user or server control??) with
properties to let me set the question text, answer texts, and any
other formatting (eg. display the answers vertically/horizontally). I
would also want some property that returns the selected answer when
Submit is clicked.
The problem I have is that the code examples I have come across have
been pretty basic 'hello world' stuff - just consisting of some
properties that can be set via html attributes to change colours,
I haven't seen any examples of how to manipulate a control from within
the code-behind of the page the control is on (if that is even
I was thinking that I would initialise the controls within Page_Load,
and then retrieve the selected answers from the Submit button's
I would be grateful for any guidance, pointers, examples or
suggestions to get me started.
Many thanks in anticipation
Re: Question on asp.net user/server controls
"Andy Stephens" <email@example.com> wrote in message
> I haven't seen any examples of how to manipulate a control from within
> the code-behind of the page the control is on (if that is even
A good place on the Web to get started with user controls is:
From the left-hand navigation links, click "Web Forms User Controls" in the
ASP.NET Web Forms section. There, you'll see a number of examples including how
to create public properties and methods (which is the way you manipulate the
control from the page code-behind).
For lots more detail on creating user control, rendered controls, composite
controls, etc. you could always pick up a good book on ASP.NET. If VB is your
..NET language of choice, I would like to suggest the one I co-authored. The
following page provides a link to a detailed table of contents:
Constance Petersen, DevX newsgroup section leader
New look; new content: http://www.smartisans.com/
Hot off the press!
"Programming the Web with Visual Basic .NET"
Please reply in the newsgroup so everyone can benefit
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL