【问题标题】:radcontrols tooltip and radgridradcontrols 工具提示和 radgrid
【发布时间】:2011-06-03 18:14:23
【问题描述】:

我正在尝试复制类似此演示的内容 http://demos.telerik.com/aspnet-ajax/tooltip/examples/tooltipversustooltipmanager/defaultvb.aspx

使用 radtooltipmanager 和 radgrid 但我收到一个错误,提示 default2 未定义

这是我的代码

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

这是他们的

Private Sub Page_Load(sender As Object, 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
        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

【问题讨论】:

    标签: vb.net telerik telerik-grid


    【解决方案1】:

    只是快速查看您的代码,我发现您正在尝试在 WebForms 页面上使用 Page.LoadControl(),而不是用户控件。我建议创建一个复制您的 WebForms 页面 (.aspx) 的用户控件 (.ascx) 并尝试加载它。

    【讨论】:

      猜你喜欢
      • 2014-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-19
      相关资源
      最近更新 更多