Setting RadioButtonList selection

Discussion in 'ASP .Net' started by =?Utf-8?B?ZGhucml2ZXJzaWRl?=, May 10, 2005.

  1. Hi guys

    I have a radiobuttonlist with 3 listItems, with values 0, 1 and 2
    respectively.

    My database stores the number, but how do I set the selected on the brl to
    correspond with the database.

    I tried rblMyRBL.Items.FindByValue(dbfield).Selected = true;

    but the selection doesn't change. Any thoughts?

    Cheers


    Dan
    =?Utf-8?B?ZGhucml2ZXJzaWRl?=, May 10, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?ZGhucml2ZXJzaWRl?=

    David Lloyd Guest

    Dan:

    Try using the SelectedValue property of the RadioButtonList.

    For example:

    rblMyRBL.SelectedValue = 2


    --
    David Lloyd
    MCSD .NET
    http://LemingtonConsulting.com

    This response is supplied "as is" without any representations or warranties.


    "dhnriverside" <> wrote in message
    news:...
    Hi guys

    I have a radiobuttonlist with 3 listItems, with values 0, 1 and 2
    respectively.

    My database stores the number, but how do I set the selected on the brl to
    correspond with the database.

    I tried rblMyRBL.Items.FindByValue(dbfield).Selected = true;

    but the selection doesn't change. Any thoughts?

    Cheers


    Dan
    David Lloyd, May 10, 2005
    #2
    1. Advertising

  3. Cheers David, that sorted it!

    Dan

    "David Lloyd" wrote:

    > Dan:
    >
    > Try using the SelectedValue property of the RadioButtonList.
    >
    > For example:
    >
    > rblMyRBL.SelectedValue = 2
    >
    >
    > --
    > David Lloyd
    > MCSD .NET
    > http://LemingtonConsulting.com
    >
    > This response is supplied "as is" without any representations or warranties.
    >
    >
    > "dhnriverside" <> wrote in message
    > news:...
    > Hi guys
    >
    > I have a radiobuttonlist with 3 listItems, with values 0, 1 and 2
    > respectively.
    >
    > My database stores the number, but how do I set the selected on the brl to
    > correspond with the database.
    >
    > I tried rblMyRBL.Items.FindByValue(dbfield).Selected = true;
    >
    > but the selection doesn't change. Any thoughts?
    >
    > Cheers
    >
    >
    > Dan
    >
    >
    >
    =?Utf-8?B?ZGhucml2ZXJzaWRl?=, May 10, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Niederberger
    Replies:
    2
    Views:
    16,408
    Christian Kaufhold
    Jan 7, 2005
  2. Andrew Crowe
    Replies:
    1
    Views:
    4,434
    Andrew Crowe
    Sep 13, 2004
  3. BizEd
    Replies:
    1
    Views:
    802
    Aamir Ghanchi
    Oct 2, 2007
  4. chief21
    Replies:
    0
    Views:
    795
    chief21
    Apr 9, 2009
  5. VR

    Cannot get radioButtonList selection

    VR, Jun 13, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    345
    kainhart
    Jun 29, 2005
Loading...

Share This Page