I am using a RadComboBox inside RadGridColumn. RadGrid is binded with a SQL Data Source. and RadCombobox is also associated with a SQLDataSource. In the insert or edit more, It has a selected index changed method associated with it which in turn gives values to another dropdown (Cascades ). This piece is working fine.
My problem starts when I try to insert or edit record. Somehow the first radCombobox Looses its value and is always getting reset at first item while saving. !!
Can you suggest why is this happening.
i have wasted hours in debugging and couldn't find the cause yet. !!
Any help is appreciated.
<Columns>
<telerik:GridTemplateColumn DataField="ProviderName" HeaderText="ProviderName" UniqueName="ProviderName">
<ItemTemplate>
<asp:Label ID="lblProvider" runat="server" Text='<%#Eval("ProviderName")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadComboBox ID="rcbProviders" runat="server" AutoPostBack="true" Text="Select Provider" DataSourceID="sqlGetAllProviders"
DataTextField="ProviderName" DataValueField="ProviderID" OnSelectedIndexChanged="rcbProviders_SelectedIndexChanged" SelectedValue='<%# Eval("ProviderID")%>'></telerik:RadComboBox>
</EditItemTemplate>
</telerik:GridTemplateColumn>
--Code for Selected index changed which cascades another drowdown
Protected Sub rcbProviders_SelectedIndexChanged(sender As Object, e As RadComboBoxSelectedIndexChangedEventArgs)
Dim editedItem As GridEditableItem = TryCast(TryCast(sender, RadComboBox).NamingContainer, GridEditableItem)
Dim providerCombo As RadComboBox = TryCast(sender, RadComboBox)
Dim programCombo As RadComboBox = TryCast(editedItem("ProgramName").FindControl("rcbPrograms"), RadComboBox)
programCombo.DataSource = GetProgramsForSelectedProvider(e.Value)
programCombo.DataBind()
End Sub
--Code to save the record
Try
Dim ddlProvider As RadComboBox = CType(e.Item.FindControl("rcbProviders"), RadComboBox)
Dim ddlPrograms As RadComboBox = CType(e.Item.FindControl("rcbPrograms"), RadComboBox)
Dim ddlLevel As RadComboBox = CType(e.Item.FindControl("rcbEducationLevel"), RadComboBox)
Dim startDate As String = Request.Form(e.Item.FindControl("radStartDate").UniqueID)
Dim endDate As String = Request.Form(e.Item.FindControl("radEndDate").UniqueID)
Dim str As String = String.Empty
EducationDetailsGE.SetValue("InstitutionID", ddlProvider.SelectedValue)
EducationDetailsGE.SetValue("EducationFieldID", ddlPrograms.SelectedValue)
EducationDetailsGE.SetValue("EducationLevelID", ddlLevel.SelectedValue)
EducationDetailsGE.SetValue("StartDate", startDate)
EducationDetailsGE.SetValue("EndDate", endDate)
If PersonGE.Save(str) Then
LoadGrid()
Else
End If
Catch ex As Exception
End Try