Go4Expert

Go4Expert (http://www.go4expert.com/)
-   ASP (http://www.go4expert.com/forums/asp/)
-   -   Adding an item to a radiobuttonlist using Hashtable (http://www.go4expert.com/forums/adding-item-radiobuttonlist-using-t19191/)

naimish 27Aug2009 08:49

Adding an item to a radiobuttonlist using Hashtable
 

Introduction



It helps us to add an item to a radio buttonlist from a Hashtable.

The code



Code: CSharp

<script runat="server">
sub Page_Load
if Not Page.IsPostBack then
  dim mycountries=New Hashtable
  mycountries.Add("N","Norway")
  mycountries.Add("S","Sweden")
  mycountries.Add("F","France")
  mycountries.Add("I","Italy")
  rb.DataSource=mycountries
  rb.DataValueField="Key"
  rb.DataTextField="Value"
  rb.DataBind()
end if
end sub
sub displayMessage(s as Object,e As EventArgs)
lbl1.text="Your favorite country is: " & rb.SelectedItem.Text
end sub
</script>
<html>
<body>
<form runat="server">
<asp:RadioButtonList id="rb" runat="server"
AutoPostBack="True" onSelectedIndexChanged="displayMessage" />
<p><asp:label id="lbl1" runat="server" /></p>
</form>
</body>
</html>


shabbir 27Aug2009 10:10

Re: Adding an item to a radiobuttonlist using Hashtable
 
Moved it to forum.

naimish 27Aug2009 10:15

Re: Adding an item to a radiobuttonlist using Hashtable
 
It was seeems an article :D


All times are GMT +5.5. The time now is 00:13.