How to bind XML in radio button list
How to bind XML in radio button list
From xml we can bind the data to radio button list
see the following code:
<%@ Import Namespace="System.Data" %>
<script runat="server">
sub Page_Load
if Not Page.IsPostBack then
dim ds=New DataSet
ds.ReadXml(MapPath("name.xml"))
radio.DataSource=ds
radio.DataValueField="value"
radio.DataTextField="text"
radio.DataBind()
end if
end sub
sub show(s as Object,e As EventArgs)
lbldisplay.text="Your favorite name is: " & radio.SelectedItem.Text
end sub
</script>
<html>
<body>
<form runat="server">
<asp:RadioButtonList id="radio" runat="server"
AutoPostBack="True" onSelectedIndexChanged="show" />
<p><asp:label id="lbldisplay" runat="server" /></p>
</form>
</body>
</html>