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>


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: