Select case for asp:radiobuttonlist (VB.net)





<script language="vb" runat="server">

Sub Page_Load()

  If Page.IsPostBack Then

    Select Case(Destination.SelectedItem.Value)

      Case "Barcelona":

        Message.Text = "Barcelona"

      Case "Oslo":

        Message.Text = "Oslo"

      Case "Lisbon"

        Message.Text = "Lisbon"

      Case else

        Message.Text = "you did not select a destination we travel to"

    End Select

  End If

End Sub

</script>



<html>

<head></head>

<body>

  <form runat="server">

  Select your choice of destination:

  <br><br>

  <asp:radiobuttonlist id="destination" runat="server">

    <asp:listitem>Barcelona</asp:listitem>

    <asp:listitem>Oslo</asp:listitem>

    <asp:listitem>Lisbon</asp:listitem>

  </asp:radiobuttonlist>

  <br><br>

  <input type="submit" value="Submit Choice">

  <br><br>

  <asp:label id="message" runat="server"/>

</form>

</body>

</html>



           

       

Tags: , , , , , ,

Leave a Reply