ASP.Net/ADO.net Database/RadioButton
Binding a RadioButton Control to a Data Source
<%@ Page Language=VB Debug=true %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OLEDB" %>
<script runat=server>
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)
If Not IsPostBack Then
Dim DBConn as OleDbConnection
Dim DBCommand As OleDbDataAdapter
Dim DSPageData as New DataSet
DBConn = New OleDbConnection( _
"PROVIDER=Microsoft.Jet.OLEDB.4.0;" _
& "DATA SOURCE=" _
& Server.MapPath("EmployeeDatabase.mdb;"))
DBCommand = New OleDbDataAdapter _
("Select ID, FirstName " _
& "From Employee " _
& "Order By FirstName", DBConn)
DBCommand.Fill(DSPageData, "Employee")
rbl1.DataSource = DSPageData.Tables("Employee").DefaultView
rbl1.DataBind()
End If
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Binding a RadioButton Control to a Data Source</TITLE>
</HEAD>
<form runat="server">
<BR><BR>
<asp:RadioButtonList
id="rbl1"
datatextfield="FirstName"
datavaluefield="ID"
runat="server"
/>
<BR><BR>
</form>
</BODY>
</HTML>
<A href="http://www.nfex.ru/Code/ASPDownload/EmployeeDatabase.zip">EmployeeDatabase.zip( 10 k)</a>