Trying to implement a RadComboBox that updates as the user types. There is no problem with the RadComboBox and populating it with the appropriate data. Where I am running into a problem is selecting a value if a user tried finding a value via a RadTextBox. The search performs properly but I need it to select the record found and update a few additional fields.
See Comment:
See Code.
See Comment:
'If sASI_Num <> "" then update Label1 & Have _ddCUName be updated with the value selected as it properly is returned by the stored procedure just not selected.
See Code.
<
telerik:RadTextBox
Runat
=
"server"
id
=
"_txtCUNum"
Width
=
"50px"
>
</
telerik:RadTextBox
>
</
td
>
<
td
>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
Text
=
"Label"
Font-Bold
=
"True"
ForeColor
=
"Green"
></
asp:Label
>
</
td
>
<
td
>CU Name:
</
td
>
<
td
>
<
telerik:RadComboBox
id
=
"_ddCUName"
Runat
=
"server"
Width
=
"450px"
EmptyMessage
=
"Type a Credit Union Name"
HighlightTemplatedItems
=
"true"
height
=
"100px"
EnableLoadOnDemand
=
"true"
OnItemsRequested
=
"RadComboBoxProduct_ItemsRequested"
>
<
headertemplate
>
<
TABLE
>
<
TBODY
>
<
TR
><
TD
>CU Name</
TD
><
TD
>City</
TD
><
TD
>State</
TD
></
TR
>
</
TBODY
>
</
TABLE
>
</
headertemplate
>
<
itemtemplate
>
<
TABLE
>
<
TBODY
>
<
TR
>
<
TD
><%#DataBinder.Eval(Container, "Text")%></
TD
>
<
TD
><%#DataBinder.Eval(Container, "Attributes['City']")%></
TD
>
<
TD
><%#DataBinder.Eval(Container, "Attributes['State']")%></
TD
>
</
TR
>
</
TBODY
>
</
TABLE
>
</
itemtemplate
>
</
telerik:RadComboBox
></
td
>
Protected
Sub
RadComboBoxProduct_ItemsRequested(
ByVal
sender
As
Object
,
ByVal
e
As
RadComboBoxItemsRequestedEventArgs)
Dim
sAsi_Num
As
Object
If
Me
._txtCUNum.text =
""
Then
sAsi_Num = DBNull.Value
Else
sAsi_Num =
Me
._txtCUNum.text
End
If
Try
oConn.Open()
Dim
ocmd
As
New
SqlCommand(
"sp_getCUSearch"
, oConn)
ocmd.CommandType = CommandType.StoredProcedure
With
ocmd.Parameters
.Add(
New
SqlParameter(
"@asi_num"
, sAsi_Num))
.Add(
New
SqlParameter(
"@SearchStr"
, e.Text))
End
With
reader = ocmd.ExecuteReader()
If
reader.HasRows
Then
'-------------------------
While
reader.Read
Dim
item
As
New
RadComboBoxItem()
item.Text =
DirectCast
(reader(
"cuName"
),
String
)
item.Value = reader(
"asi_num"
).ToString()
Dim
sCity
As
String
=
DirectCast
(reader(
"City"
),
String
)
Dim
sState
As
String
=
DirectCast
(reader(
"State_ID"
),
String
)
item.Attributes.Add(
"City"
, sCity.ToString())
item.Attributes.Add(
"State"
, sState.ToString())
'item.Value += ":" + unitPrice.ToString()
_ddCUName.Items.Add(item)
item.DataBind()
'Next
End
While
'If sASI_Num <> "" then update Label1 & Have _ddCUName be updated with the value selected as it properly is returned by the stored procedure just not selected.
End
If
Catch
ex
As
Exception
Finally
oConn.Close()
End
Try
End
Sub