I've bound data to a radgrid which I'm using to just reimplement a preexisting gridview control.
I keep getting the error "System.Web.HttpException: The DataSourceID of 'drpGradesEdit' must be the
ID of a control of type IDataSource. A control with ID 'sqlDSGradesEdit' could not be found." when
the grid goes into edit mode
One of the columns has a button that fires the Edit command and two have radcombobox + SQLDataSource controls on their Edit templates
and when I click the edit button I loop through the following bit of code until I get the the item before the one I clicked edit on, and once
It finishes the sub for that previous item It jumps to my error handling function with the above error message.
Protected Sub rgUserQuals_RowDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgUserQuals.ItemDataBound
' Check that Item sending the event is a RadGrid Data Item
If (TypeOf e.Item Is Telerik.Web.UI.GridDataItem) Then
'Go through all the Rad grid Items in edit mode and
Dim GridEditableItem As Telerik.Web.UI.GridEditableItem
If (TypeOf e.Item Is Telerik.Web.UI.GridEditableItem) And e.Item.IsInEditMode Then
' Then
Try
Dim teststring As String = ""
teststring = Me.rgUserQuals.MasterTableView.DataKeyValues(e.Item.ItemIndex)("Qualification")
Dim gs As SqlDataSource = CType(e.Item.FindControl("sqlDSGradesEdit"), SqlDataSource)
gs.SelectParameters("Qualification").DefaultValue = _
Me.rgUserQuals.MasterTableView.DataKeyValues(e.Item.ItemIndex)("Qualification")
gs.SelectParameters("QualType").DefaultValue = _
Me.rgUserQuals.MasterTableView.DataKeyValues(e.Item.ItemIndex)("QualType")
Dim cbo As Telerik.Web.UI.RadComboBox = CType(e.Item.FindControl("drpGradesEdit"), Telerik.Web.UI.RadComboBox)
cbo.DataSourceID = gs.ID
cbo.DataBind()
cbo.SelectedValue = Me.rgUserQuals.MasterTableView.DataKeyValues(e.Item.ItemIndex)("Grade")
Dim ss As SqlDataSource = CType(e.Item.FindControl("sqlDSSchoolsEdit"), SqlDataSource)
ss.SelectParameters("SchoolName").DefaultValue = _
Me.rgUserQuals.MasterTableView.DataKeyValues(e.Item.ItemIndex)("SchoolName")
Dim rcbuqes As Telerik.Web.UI.RadComboBox = CType(e.Item.FindControl("rcbUsersQualEditSchool"), Telerik.Web.UI.RadComboBox)
rcbuqes.DataSourceID = ss.ID
rcbuqes.DataBind()
rcbuqes.SelectedValue = Me.rgUserQuals.MasterTableView.DataKeyValues(e.Item.ItemIndex)("SchoolName")
Catch ex As Exception
End Try
End If
End If
End Sub