Hi,
I have a ComboBox with no DataSource, in a GridEditForm, that I fill in the ItemRequested Event. I want to programatically select an item but, my combobox is empty until I click on it to fire the Event and then fill it. So is there a way to fill this combobox to select the right item? I am using this because I got alot of item in this combobox.
Here is my event sub:
Thanks.
I have a ComboBox with no DataSource, in a GridEditForm, that I fill in the ItemRequested Event. I want to programatically select an item but, my combobox is empty until I click on it to fire the Event and then fill it. So is there a way to fill this combobox to select the right item? I am using this because I got alot of item in this combobox.
Here is my event sub:
Protected
Sub
cboGroupe_ItemsRequested(
ByVal
sender
As
Object
,
ByVal
e
As
RadComboBoxItemsRequestedEventArgs)
Dim
cbo
As
RadComboBox =
DirectCast
(sender, RadComboBox)
'get all customers whose name starts with e.Text
Dim
sqlGroupes
As
LWebStatement = ExecuteSql(
"Select gral_numero, gral_description "
& _
" from phfgrall where pram_sequence = "
+ GetStr(GSite_phfgrall) +
" and (gral_numero like '"
& Convert.ToString(e.Text) & _
"%' or gral_description like '"
& Convert.ToString(e.Text) &
"%')"
& _
" order by gral_description"
)
Dim
itemOffset
As
Integer
= e.NumberOfItems
Dim
endOffset
As
Integer
= Math.Min(itemOffset + 10, sqlGroupes.Tables(0).Rows.Count)
e.EndOfItems = endOffset = sqlGroupes.Tables(0).Rows.Count
For
i
As
Integer
= itemOffset
To
endOffset - 1
Dim
item
As
RadComboBoxItem =
New
RadComboBoxItem(sqlGroupes.Tables(0).Rows(i)(
"gral_description"
).ToString, sqlGroupes.Tables(0).Rows(i)(
"gral_numero"
).ToString())
item.Attributes(
"gral_description"
) = sqlGroupes.Tables(0).Rows(i)(
"gral_description"
).ToString
item.Attributes(
"gral_numero"
) = sqlGroupes.Tables(0).Rows(i)(
"gral_numero"
).ToString
cbo.Items.Add(item)
Next
e.Message = GetStatusMessage(endOffset, sqlGroupes.Tables(0).Rows.Count)
cbo.DataBind()
End
Sub
Thanks.