开发者

radcontrols tooltip and radgrid

开发者 https://www.devze.com 2023-03-10 12:13 出处:网络
I am trying to replicate something like this demo http://demos.telerik.com/aspnet-ajax/tooltip/examples/tooltipversustooltipmanager/defaultvb.aspx

I am trying to replicate something like this demo http://demos.telerik.com/aspnet-ajax/tooltip/examples/tooltipversustooltipmanager/defaultvb.aspx

using the radtooltipmanager and the radgrid but i get an error that default2 is not defined

here is my code

Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
            If Me.IsPostBack Then
                'GridView does not keep its items' IDs after postback, so rebind it or else tooltip manager will not show tooltips
                RadGrid1.DataBind()
            End If
        End Sub


    Protected Sub OnAjaxUpdate(ByVal sender As Object, ByVal args As ToolTipUpdateEventArgs)
        Dim ctrl As Control = Page.LoadControl("default2.aspx")
        args.UpdatePanel.ContentTemplateContainer.Controls.Add(ctrl)
        Dim details As default2 = DirectCast(ctrl, default2)
        details.Country = args.Value
    End Sub
    Protected Sub Grid1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)

        Dim row As Data.DataRowView = DirectCast(e.Row.DataItem, Data.DataRowView)
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim country As String = row("owed").ToString()
            RadToolTipManager1.TargetControls.Add(e.Row.ClientID, country, True)
        End If
    End Sub

and this is theirs

Private Sub Page_Load(sender As Object, e As System.EventArgs)
    If Me.IsPostBack Then
        'GridView does not keep its items开发者_Python百科' IDs after postback, so rebind it or else tooltip manager will not show tooltips
        Grid1.DataBind()
    End If
End Sub

Protected Sub OnAjaxUpdate(sender As Object, args As ToolTipUpdateEventArgs)
    Dim ctrl As Control = Page.LoadControl("InfoCustomers.ascx")
    args.UpdatePanel.ContentTemplateContainer.Controls.Add(ctrl)
    Dim details As InfoCustomers = DirectCast(ctrl, InfoCustomers)
    details.Country = args.Value
End Sub
Protected Sub Grid1_RowDataBound(sender As Object, e As GridViewRowEventArgs)
    Dim row As DataRowView = DirectCast(e.Row.DataItem, DataRowView)
    If e.Row.RowType = DataControlRowType.DataRow Then
        Dim country As String = row("Country").ToString()
        RadToolTipManager1.TargetControls.Add(e.Row.ClientID, country, True)
    End If

End Sub
End Class


Just looking over your code quickly I see that you are attempting to use Page.LoadControl() on a WebForms page, and not a user control. I recommend creating a user control (.ascx) replicating your WebForms page (.aspx) and attempt to load that instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消