Prop Webcontrol Listcontrol Datavaluefield
# ASP.NET DataValueField Property
* * ListControl Control Reference](#)
* * *
## Definition and Usage
The DataValueField property specifies the data source field to bind to the Value property of each item in the control.
* * *
## Example
The following example uses an XML file to populate a RadioButtonList:
sub Page_Load
if Not Page.IsPostBack then
dim mycountries=New DataSet
mycountries.ReadXml(MapPath("countries.xml"))
rb.DataSource=mycountries
rb.DataValueField="value"
rb.DataTextField="text"
rb.DataBind()
end if
end sub
sub displayMessage(s as Object,e As EventArgs)
lbl1.text="You selected: " & rb.SelectedItem.Text
end sub
[Demo Example Β»](#)
The XML file used in the example is [countries.xml](#)
* * ListControl Control Reference](#)
YouTip