I have a rad combo box that I bind in my code with a data table. Whenever I select an item and then click out of the combo box, it doesn't keep the item I had picked selected. You can see my problem here http://michael.sprayapplications.com/temp.aspx . Just pick an item and then click out of the dropdown. Here is my aspx code
here's my vb code behind and the function it calls
And the function
<
telerik:RadComboBox
ID
=
"salesInput"
runat
=
"server"
Width
=
"200px"
MarkFirstMatch
=
"true"
>
</
telerik:RadComboBox
>
here's my vb code behind and the function it calls
Protected
Sub
Page_Load(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Me
.Load
If
(
Not
Page.IsPostBack)
Then
'populate the dropdown
Dim
tableOfData
As
DataTable = MyFunctions.createCrewDeleteTable()
salesInput.DataSource = tableOfData
salesInput.DataTextField =
"Salesman"
salesInput.DataValueField =
"CrewId"
salesInput.DataBind()
End
If
End
Sub
And the function
'this function gets the data for the crew dropdown
'this sub returns a data table to bind to the dropdown
Public
Shared
Function
createCrewDeleteTable()
'a new data table
Dim
table
As
DataTable =
New
DataTable()
table.Columns.Add(
"Salesman"
)
table.Columns.Add(
"CrewId"
)
Dim
type
'my sql connection
Dim
myConn
As
New
Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings(
"connection"
).ToString)
'the name of the stored procedure
Dim
strSQL =
"select FirstName+' '+LastName as Name, CrewType, CrewId from Crew where Deleted <> 'yes' "
& _
"AND crewid > 1 order by LastName, Firstname"
Try
myConn.Open()
Dim
readCommand
As
New
Data.SqlClient.SqlCommand(strSQL, myConn)
'while we have rows from the stored procedure
'we will add them to a data table
Dim
cdr
As
SqlDataReader = readCommand.ExecuteReader()
While
cdr.Read()
If
(cdr(1).ToString =
"3"
)
Then
type =
"Salesman"
ElseIf
cdr(1).ToString =
"2"
Then
type =
"Crew Chief"
Else
type =
"Crew"
End
If
'if cdr(2)
If
(cdr.Item(0).ToString <>
""
)
Then
table.Rows.Add(
New
String
() {cdr.Item(0) &
" - "
& type, cdr.Item(1)})
End
If
End
While
'while cdr.Read()
Catch
ex
As
Exception
End
Try
myConn.Dispose()
Return
table
End
Function