Dynamically set selected item of RadioButtonList

Discussion in 'ASP .Net' started by Groove, May 11, 2006.

  1. Groove

    Groove Guest

    I've searched numerous threads and posts and can't seem to find a fitting
    answer. Hopefully this is simple - it seems very simple.

    I'm trying to set a SelectedValue of a RadioButtonList to a value from a db
    record upon page load. Yet, when the page loads, the RBL has nothing
    selected.

    Any ideas? The value from the record is definitely a 0 or a 1.

    ....in page_load ..

    radAccommodated.SelectedValue = drData1("AllAccommodated")



    ...on page...

    <asp:RadioButtonList ID="radAccommodated" runat="server" CellPadding="3"
    CellSpacing="0" Width="90%">

    <asp:ListItem Value="1">Yes, all requests accommodated.</asp:ListItem>

    <asp:ListItem Value="0">No, all are not accommodated. .</asp:ListItem>

    </asp:RadioButtonList>



    Thanks!
    Groove, May 11, 2006
    #1
    1. Advertising

  2. Groove

    Groove Guest

    Nevermind. Db field was defined as bit. I redefined it as TinyInt.

    Thanks!



    "Groove" <> wrote in message
    news:...
    > I've searched numerous threads and posts and can't seem to find a fitting
    > answer. Hopefully this is simple - it seems very simple.
    >
    > I'm trying to set a SelectedValue of a RadioButtonList to a value from a
    > db record upon page load. Yet, when the page loads, the RBL has nothing
    > selected.
    >
    > Any ideas? The value from the record is definitely a 0 or a 1.
    >
    > ...in page_load ..
    >
    > radAccommodated.SelectedValue = drData1("AllAccommodated")
    >
    >
    >
    > ..on page...
    >
    > <asp:RadioButtonList ID="radAccommodated" runat="server" CellPadding="3"
    > CellSpacing="0" Width="90%">
    >
    > <asp:ListItem Value="1">Yes, all requests accommodated.</asp:ListItem>
    >
    > <asp:ListItem Value="0">No, all are not accommodated. .</asp:ListItem>
    >
    > </asp:RadioButtonList>
    >
    >
    >
    > Thanks!
    >
    >
    >
    >
    >
    >
    Groove, May 11, 2006
    #2
    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. =?Utf-8?B?UmljaGFyZA==?=

    Selected item in RadioButtonList

    =?Utf-8?B?UmljaGFyZA==?=, Jan 7, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    775
    =?Utf-8?B?UmljaGFyZA==?=
    Jan 7, 2005
  2. =?Utf-8?B?anVzdHN0YXJ0ZXI=?=

    radiobuttonlist get selected item

    =?Utf-8?B?anVzdHN0YXJ0ZXI=?=, Oct 25, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    3,116
    S. Justin Gengo
    Oct 26, 2005
  3. Iain
    Replies:
    3
    Views:
    927
  4. mldardy
    Replies:
    0
    Views:
    961
    mldardy
    Sep 28, 2010
  5. Peter Afonin

    How to change font of selected item in RadioButtonList

    Peter Afonin, Feb 22, 2004, in forum: ASP .Net Web Controls
    Replies:
    6
    Views:
    638
    Peter Afonin
    Feb 23, 2004
Loading...

Share This Page