Access RadioButtonList Item Using VBScript

RadioButtonList Item Using VBScript

Visual Basic is a client side Scripting Language as like Java Script.here we want ti Access RadioButtonList Item Using VBScript.



Access Item from RadioButtonList Using VBScript:

<script runat="server" language="vb">
  Sub Page_Load()
   if Page.IsPostBack then
    lblmsg.Text = "You have selected the following: " + radio1.SelectedItem.Value
   end if
  End Sub
</script>

This is a Script code by this we can Access control on client side.

<html>
  <head>
    <title>Radio Button List Example</title>

   <% write Above Script code in head tag .............%>
Asp.net Radiobutton control
Asp.net Radiobutton control

  </head>
  <body>
    <asp:label id="lblmsg" runat="server" />
    <br /><br />
    Which city do you wish to look at hotels for?
    <br /><br />
    <form id="Form1" runat="server">
   <asp:radiobuttonlist id="radio1" runat="server">
   <asp:listitem id="opt1" runat="server" value="option1" />
   <asp:listitem id="opt2" runat="server" value="option2" />
   <asp:listitem id="opt3" runat="server" value="option3" />
   </asp:radiobuttonlist>
      <br /><br />
      <input type="ok">
    </form>
  </body>
</html>
Web page preview 

Comments