No matter what I try, the SelectedValue of the CountryCombo is always null, therefore I cannot load the Province/State Combo?
<
telerik:RadComboBox
ID
=
"CountryCombo"
runat
=
"server"
EnableLoadonDemand
=
"true"
>
</
telerik:RadComboBox
>
<
telerik:RadComboBox
ID
=
"ProvinceCombo"
runat
=
"server"
Width
=
"325"
EnableLoadonDemand
=
"true"
>
</
telerik:RadComboBox
>
Private
Sub
RecipientsGrid_NeedDataSource(sender
As
Object
, e
As
Telerik.Web.UI.GridNeedDataSourceEventArgs)
Handles
RecipientsGrid.NeedDataSource
Dim
ctx
As
New
DataEntities
RecipientsGrid.DataSource = ctx.RecipientOrganizations.ToList
AddOrganizationButton.Visible =
False
RecipientOrganizationComboBox.Visible =
False
End
Sub
Private Sub RecipientsGrid_ItemCreated(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles RecipientsGrid.ItemCreated
If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then
Dim editedItem As GridEditableItem = TryCast(e.Item, GridEditableItem)
Dim CountryCombo As RadComboBox = TryCast(editedItem.FindControl("CountryCombo"), RadComboBox)
Dim ProvinceCombo As RadComboBox = TryCast(editedItem.FindControl("ProvinceCombo"), RadComboBox)
AddHandler CountryCombo.ItemsRequested, AddressOf CountryCombo_ItemsRequested
AddHandler ProvinceCombo.ItemsRequested, AddressOf ProvinceCombo_ItemsRequested
End If
End Sub
Private Sub CountryCombo_ItemsRequested(sender As Object, e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs)
Dim Combo As RadComboBox = sender
LoadCountries(Combo)
End Sub
Private Sub ProvinceCombo_ItemsRequested(sender As Object, e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs)
Dim Combo As RadComboBox = CType(sender, RadComboBox)
Dim editedItem As GridEditableItem = CType(Combo.NamingContainer, GridEditableItem)
Dim CountryCombo As RadComboBox = CType(editedItem.FindControl("CountryCombo"), RadComboBox)
Dim _item As New RadComboBoxItemData()
LoadProvinces(_item.Value, Combo)
End Sub
Protected Sub LoadCountries(ByVal Control As RadComboBox)
Using context As New DataEntities
With Control
.DataValueField = "CountryId"
.DataTextField = "CountryName"
.DataSource = context.Countries.OrderBy(Function(x) x.displayOrder).ToList
End With
Control.Width = Unit.Pixel(320)
Control.DataBind()
End Using
End Sub