aspx code:
<
td ><telerik:RadComboBox ID="rcboNumAdultsFL" runat="server" Width="45px" BorderColor="#999999"></telerik:RadComboBox></td>
VB.NET code:
Private
Sub BindToNumberList(ByVal combo As RadComboBox)
Dim itemsList As String() = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}
combo.DataSource = itemsList
combo.DataBind()
End Sub
Protected
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If
Not Page.IsPostBack Then
BindToNumberList(
Me.rcboNumAdultsFL)
'Populate the datatable
Dim sConnString As String = ConfigurationManager.ConnectionStrings("PU89").ConnectionString
Dim objConnection As New SqlClient.SqlConnection(sConnString)
Dim strSQL As String = "SELECT * FROM tblRegistration WHERE ID='" & _ID & "';"
Dim dbComm As New SqlClient.SqlCommand(strSQL, objConnection)
Dim objDR As SqlClient.SqlDataReader
Try
objConnection.Open()
objDR = dbComm.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
While objDR.Read()
With objDR
Me
.rcboNumAdultsFL.SelectedItem.Value = .Item("NumAdultsFL")
Me.rcboNumAdultsFL.SelectedItem.Text = .Item("NumAdultsFL")
End
With
End While
Catch ex As Exception
Response.Write(ex.Message)
Response.End()
Finally
If objConnection.State = ConnectionState.Open Then
objConnection.Close()
End If
End Try
End If
End Sub
This code results in the combo box showing the correct value from the db but it replaces the "0" in the array list. How do I get it to work properly?
Thanks,
Shelley