-
Question on asp.net user/server controls
Hi
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,
text, etc.
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
possible).
I was thinking that I would initialise the controls within Page_Load,
and then retrieve the selected answers from the Submit button's
ServerClick code.
I would be grateful for any guidance, pointers, examples or
suggestions to get me started.
Many thanks in anticipation
Andy Stephens
-
Re: Question on asp.net user/server controls
Hi Andy,
"Andy Stephens" <andy@fitech.co.uk> wrote in message
news:3d786a8e$1@10.1.10.29...
> 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
> possible).
A good place on the Web to get started with user controls is:
http://www.asp.net/Tutorials/quickstart.aspx
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:
http://www.smartisans.com/pwebvbnet/prev_det_toc.aspx
--
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"
http://amazon.com/exec/obidos/ASIN/1...tancepeterseA/
--
Please reply in the newsgroup so everyone can benefit
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|