I have copied the source code from the VB version of the demo which demonstrates how to pop up a custom control with database content.
I also duplicated the database tables.
I can get 95% of the way, and then I find an error that makes no sense to me. The attached screen shot indicates a problem with creating an instance of the custom control as "ProductDetailsVB" not defined. This is actually detected in VS2010, but I ran the code to create a better error description.
I have confirmed that the ASCX control works with static placement on another page. In order to run the demo code, I have commented out two lines "Dim Details as ProductDetailsVB..." and "details.ProductID. When I do this I get the appropriate behavior for the popup control, minus actual database content because it is not receiving the ProductID.
I have created the control as "ProductDetailsVB.ascx" to match the source code. But I do note that the online demo references "ProductDetailsCS.ascx" which would not be appropriate for a VB programmer such as myself.
This is my first custom control, and I have no clues as to the error, and am doubly confused over the reference to CS in a VB demo.
I also duplicated the database tables.
I can get 95% of the way, and then I find an error that makes no sense to me. The attached screen shot indicates a problem with creating an instance of the custom control as "ProductDetailsVB" not defined. This is actually detected in VS2010, but I ran the code to create a better error description.
I have confirmed that the ASCX control works with static placement on another page. In order to run the demo code, I have commented out two lines "Dim Details as ProductDetailsVB..." and "details.ProductID. When I do this I get the appropriate behavior for the popup control, minus actual database content because it is not receiving the ProductID.
I have created the control as "ProductDetailsVB.ascx" to match the source code. But I do note that the online demo references "ProductDetailsCS.ascx" which would not be appropriate for a VB programmer such as myself.
This is my first custom control, and I have no clues as to the error, and am doubly confused over the reference to CS in a VB demo.
Partial Class pop2
Inherits System.Web.UI.Page
Protected Sub OnAjaxUpdate(sender As Object, args As ToolTipUpdateEventArgs)
Me.UpdateToolTip(args.Value, args.UpdatePanel)
End Sub
Private Sub UpdateToolTip(elementID As String, panel As UpdatePanel)
Dim ctrl As Control = Page.LoadControl("ProductDetailsvb.ascx")
panel.ContentTemplateContainer.Controls.Add(ctrl)
Dim details As ProductDetailsVB = DirectCast(ctrl, ProductDetailsVB)
details.ProductID = elementID
End Sub
Protected Sub RadGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs)
If e.Item.ItemType = GridItemType.Item OrElse e.Item.ItemType = GridItemType.AlternatingItem Then
Dim target As Control = e.Item.FindControl("targetControl")
If Not [Object].Equals(target, Nothing) Then
If Not [Object].Equals(Me.RadToolTipManager1, Nothing) Then
'Add the button (target) id to the tooltip manager
Me.RadToolTipManager1.TargetControls.Add(target.ClientID, (TryCast(e.Item, GridDataItem)).GetDataKeyValue("ProductID").ToString(), True)
End If
End If
End If
End Sub
Protected Sub RadGrid1_ItemCommand(source As Object, e As GridCommandEventArgs)
If e.CommandName = "Sort" OrElse e.CommandName = "Page" Then
RadToolTipManager1.TargetControls.Clear()
End If
End Sub
End Class