Get selected item index from asp:RadioButtonList (VB.net) : RadioButtonList « ASP.net Controls « ASP.NET Tutorial

ASP.NET Tutorial
1. ASP.Net Instroduction
2. Language Basics
3. ASP.net Controls
4. HTML Controls
5. Page Lifecycle
6. Response
7. Collections
8. Validation
9. Development
10. File Directory
11. Sessions
12. Cookie
13. Cache
14. Custom Controls
15. Profile
16. Configuration
17. LINQ
18. ADO.net Database
19. Data Binding
20. Ajax
21. Authentication Authorization
22. I18N
23. Mobile
24. WebPart
25. XML
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
ASP.NET Tutorial » ASP.net Controls » RadioButtonList 
3. 14. 1. Get selected item index from asp:RadioButtonList (VB.net)
<%@ Page Language="VB" %>

<script runat="server">
   sub Submit(Sender as Object, e as EventArgs)
      dim strIncome as string = lbIncome.SelectedItem.Text
      dim strAge as string = rlAge.SelectedItem.Text
      
      lblMessage.Text = "Hello " & tbName.Text & "!" & _
         "Your income is: " & strIncome & "<br>" & _
         "Your age is: " & strAge & "<br>"
      
      if rlAge.SelectedIndex < then
         lblMessage.Text += "You're a young one!"
      else
         lblMessage.Text += "You're a wise one!"
      end if
      
      if cbNewsletter.Checked then
         lblMessage.Text += "You will be receiving our" & _
            " newsletter shortly."
      end if
   end sub   
</script>

<html><body>
   <form runat="server">
      <asp:Label id="lblMessage" runat="server" />
      
      Enter your name: 
      <asp:TextBox id="tbName" runat="server" />
      
      Choose your age:<br>
      <asp:RadioButtonList id="rlAge" runat="server"
         RepeatDirection="horizontal">
         <asp:ListItem><18</asp:ListItem>
         <asp:ListItem>19-24</asp:ListItem>
         <asp:ListItem>25-34</asp:ListItem>
         <asp:ListItem>35-49</asp:ListItem>
         <asp:ListItem>50-65</asp:ListItem>
      </asp:RadioButtonList>
      
      Choose your income:<br>
      <asp:ListBox id="lbIncome" runat="server"
         size=1>
         <asp:ListItem>< $9</asp:ListItem>
         <asp:ListItem>$10-$99</asp:ListItem>
         <asp:ListItem>$100-$499</asp:ListItem>
         <asp:ListItem>> $500</asp:ListItem>
      </asp:ListBox>
     
      Do you want to receive our newsletter?<br>
      <asp:Checkbox id="cbNewsletter" runat="server"
         Text="Yes!" />
      
      <asp:Button id="btSubmit" runat="server"
         Text="Submit" OnClick="Submit" />
   </form>
</body></html>
3. 14. RadioButtonList
3. 14. 1. Get selected item index from asp:RadioButtonList (VB.net)
3. 14. 2. Data binding with the RadioButtonList Control
3. 14. 3. A combination of bullet-list and radio-button list controls
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.