Results 1 to 5 of 5

Thread: radio buttons

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    radio buttons

    How can I set 1 of my radio buttons to load up checked?

    That wasnt to bad now was it.

    CHeers

    Parksie

  2. #2
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    in the page load event RadioButton.Checked = True

  3. #3

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018
    Its not a single radio button but a radio button list.

    I want the first item to be ticked by default.

    Cheers

    Parksie

  4. #4
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Fort Collins, CO
    Posts
    366
    VB Code:
    1. <script language="vb" runat="server">
    2. Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
    3.     If Not Page.IsPostBack
    4.         MyRadioButtonList.Items(0).Selected = True
    5.     End If
    6. End Sub
    7. </script>
    8. <html>
    9.   <body>
    10.     <form id="Form1" method="post" runat="server">
    11.         <asp:RadioButtonList
    12.             id="MyRadioButtonList"
    13.             runat="server">
    14.             <asp:ListItem Value="1">Item1</asp:ListItem>   
    15.             <asp:ListItem Value="2">Item2</asp:ListItem>
    16.         </asp:RadioButtonList>
    17.     </form>
    18.   </body>
    19. </html>

  5. #5

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018
    Cheers.

    May the sun always shine on fort collins.

    Parksie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width