DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Question on user/server controls

  1. #1
    Andy Stephens Guest

    Question on 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,
    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
    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

  2. #2
    Constance J. Petersen Guest

    Re: Question on user/server controls

    Hi Andy,

    "Andy Stephens" <> 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
    > possible).

    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:
    Hot off the press!
    "Programming the Web with Visual Basic .NET"
    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
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center