Here is my code.
ASPX
<tr>
<td align="left">
<telerik:RadComboBox EnableScreenBoundaryDetection="false" ID="rdcbCustomer" runat="server" Skin="Vista" AppendDataBoundItems="true"
Filter="StartsWith" DataSource='<%# Iif (TypeOf Container is GridEditFormInsertItem, ActiveCustomers, Customers) %>'
DataTextField="Name" DataValueField="CustomerId" AutoPostBack="true" CausesValidation="false" OnSelectedIndexChanged="rdcbCustomer_OnSelectedIndexChanged">
<Items>
<telerik:RadComboBoxItem Text="---Select---" Value="-1" Selected="true" />
</Items>
</telerik:RadComboBox>
<br />
<asp:RequiredFieldValidator ID="customerValid" ControlToValidate="rdcbCustomer" Text="Customer is required."
Display="dynamic" runat="server" InitialValue="---Select---" /><br />
</td>
</tr>
<tr align="left">
<td>
<b>Party: *</b>
</td>
</tr>
<tr>
<td align="left">
<telerik:RadComboBox EnableScreenBoundaryDetection="false" ID="rdcbParty" runat="server" Skin="Vista" AppendDataBoundItems="true"
Filter="StartsWith" DataSource='<%# Parties %>' DataTextField="Name" DataValueField="PartyId">
<Items>
<telerik:RadComboBoxItem Text="---Select---" Value="-1" Selected="true" />
</Items>
</telerik:RadComboBox>
<br />
<asp:RequiredFieldValidator ID="partyValid" ControlToValidate="rdcbParty" Text="Party is required."
Display="dynamic" runat="server" InitialValue="---Select---" /><br />
</td>
</tr>
ASPX.VB
Protected Sub rdcbCustomer_OnSelectedIndexChanged(ByVal o As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs)
Parties = LoadPartiesListByCustomer(e.Value)
Dim combo1 As RadComboBox = TryCast(o, RadComboBox)
Dim editItem As GridEditFormItem = TryCast(combo1.NamingContainer, GridEditFormItem)
Dim combo2 As RadComboBox = TryCast(editItem.FindControl("rdcbParty"), RadComboBox)
combo2.DataSource = Parties
End Sub
Protected Function LoadPartiesListByCustomer(ByVal cust_id) As IList(Of Party)
Dim party As IList(Of Party) = New List(Of Party)()
Dim dtParty As DataTable = cDA.GetPartiesByCustomer(cust_id)
If dtParty.Rows.Count > 0 Then
For Each dr As DataRow In dtParty.Rows
Dim p As New Party()
p.PartyId =
Convert.ToInt32(dr("PartyId"))
p.Name =
Convert.ToString(dr("Name"))
p.IsActive =
Convert.ToBoolean(dr("IsActive"))
party.Add(p)
Next
End If
'Parties.Clear()
Parties = party
Return Parties
End Function
Please help me to fix this problem