Web 部件连接 asp.net VB

发布于 2024-07-13 18:01:54 字数 3524 浏览 6 评论 0原文

我在使用 vb.net asp.net webparts 时遇到以下问题。 我试图在 Web 部件之间创建静态连接,但遇到了问题,即:

找不到 ID 为“Ucl_Diary_Summary1”的连接提供程序 Web 部件

我将以下内容定义为我的 iterface:

Public Interface IDiaryPartsProvider

    function Test as String

End Interface

我将以下内容定义为我的使用者 (UserControl):

Partial Class UsrCtrls_Diary_ucl_DiaryAwaitingReview
    Inherits System.Web.UI.UserControl

    <ConnectionConsumer("Test", "myID")> _
    Public Sub GetTextTransferInterface(ByVal provider As IDiaryPartsProvider)
        Dim a As String = provider.Test()
        UserMsgBox(a.ToString, Me.Page)
    End Sub

End Class

我将以下内容定义为我的提供程序 (UserControl):

Partial Class UsrCtrls_Diary_Diary_Summary
    Inherits System.Web.UI.UserControl

    Implements IWebPart, IDiaryPartsProvider

    <ConnectionProvider("myID")> _
    Public Function Test() As String Implements IDiaryPartsProvider.Test
        Return "this is a test"
    End Function
End Class

我有默认值。 aspx 如下:

<%@ Register Src="UsrCtrls/Diary/ucl_Diary_Summary.ascx" TagName="ucl_Diary_Summary"
    TagPrefix="uc4" %>
<%@ Register Src="UsrCtrls/Diary/ucl_DiaryAwaitingReview.ascx" TagName="ucl_DiaryAwaitingReview"
    TagPrefix="uc5" %>

<asp:WebPartManager ID="WebPartManager1" runat="server">
            <StaticConnections>
                <asp:WebPartConnection ID="cnn"
                ConsumerID="Ucl_DiaryAwaitingReview1"
                ProviderID="Ucl_Diary_Summary1"
                />
            </StaticConnections>
        </asp:WebPartManager>

<asp:WebPartZone ID="zoneDiaryTopLeft" runat="server" EmptyZoneText="Add WebPart Here" DragHighlightColor="#454777" HeaderText=" ">

                                    <ZoneTemplate>
                                    <asp:Panel ID="pnl1" runat="server" title="Claims Awaiting Review">
                                    <asp:UpdatePanel ID="udp_TopLeft" runat="server" ChildrenAsTriggers="False" UpdateMode="Conditional">
                                    <ContentTemplate>
                                        <uc5:ucl_DiaryAwaitingReview ID="Ucl_DiaryAwaitingReview1" runat="server" title="Claims Awaiting Review" />
                                        </ContentTemplate>
                                    </asp:UpdatePanel>
                                    </asp:Panel>
                                    </ZoneTemplate>
</asp:WebPartZone>

<asp:WebPartZone ID="zoneDiaryTopRight" runat="server" EmptyZoneText="Add WebPart Here" DragHighlightColor="#454777" HeaderText=" ">
                        <ZoneTemplate>
                        <asp:Panel ID="PNL2" runat="server" title="Diary Summary">
                       <asp:UpdatePanel ID="udp_TopRight" runat="server" ChildrenAsTriggers="False" UpdateMode="Conditional">
                        <ContentTemplate>
                            <uc4:ucl_Diary_Summary ID="Ucl_Diary_Summary1" runat="server" Title="Diary Summary" />
                        </ContentTemplate>
                        </asp:UpdatePanel>
                        </asp:Panel>
                        </ZoneTemplate>
</asp:WebPartZone>

我只能假设它是因为我有我的 webparts - 用户控件包装在一个面板(用于滚动)中,还有一个我用来刷新的更新面板,那么我如何让它看到用户控件?

提前致谢。

詹姆士。

Im having the following problem with vb.net asp.net webparts. Im trying to create a static connection between webparts but im running into a problem, namely:

Could not find the connection provider Web Part with ID 'Ucl_Diary_Summary1'

I have the following defined as my iterface:

Public Interface IDiaryPartsProvider

    function Test as String

End Interface

I have the following as my Consumer (UserControl):

Partial Class UsrCtrls_Diary_ucl_DiaryAwaitingReview
    Inherits System.Web.UI.UserControl

    <ConnectionConsumer("Test", "myID")> _
    Public Sub GetTextTransferInterface(ByVal provider As IDiaryPartsProvider)
        Dim a As String = provider.Test()
        UserMsgBox(a.ToString, Me.Page)
    End Sub

End Class

I have the following defined as my Provider (UserControl):

Partial Class UsrCtrls_Diary_Diary_Summary
    Inherits System.Web.UI.UserControl

    Implements IWebPart, IDiaryPartsProvider

    <ConnectionProvider("myID")> _
    Public Function Test() As String Implements IDiaryPartsProvider.Test
        Return "this is a test"
    End Function
End Class

I have my default.aspx as follows:

<%@ Register Src="UsrCtrls/Diary/ucl_Diary_Summary.ascx" TagName="ucl_Diary_Summary"
    TagPrefix="uc4" %>
<%@ Register Src="UsrCtrls/Diary/ucl_DiaryAwaitingReview.ascx" TagName="ucl_DiaryAwaitingReview"
    TagPrefix="uc5" %>

<asp:WebPartManager ID="WebPartManager1" runat="server">
            <StaticConnections>
                <asp:WebPartConnection ID="cnn"
                ConsumerID="Ucl_DiaryAwaitingReview1"
                ProviderID="Ucl_Diary_Summary1"
                />
            </StaticConnections>
        </asp:WebPartManager>

<asp:WebPartZone ID="zoneDiaryTopLeft" runat="server" EmptyZoneText="Add WebPart Here" DragHighlightColor="#454777" HeaderText=" ">

                                    <ZoneTemplate>
                                    <asp:Panel ID="pnl1" runat="server" title="Claims Awaiting Review">
                                    <asp:UpdatePanel ID="udp_TopLeft" runat="server" ChildrenAsTriggers="False" UpdateMode="Conditional">
                                    <ContentTemplate>
                                        <uc5:ucl_DiaryAwaitingReview ID="Ucl_DiaryAwaitingReview1" runat="server" title="Claims Awaiting Review" />
                                        </ContentTemplate>
                                    </asp:UpdatePanel>
                                    </asp:Panel>
                                    </ZoneTemplate>
</asp:WebPartZone>

<asp:WebPartZone ID="zoneDiaryTopRight" runat="server" EmptyZoneText="Add WebPart Here" DragHighlightColor="#454777" HeaderText=" ">
                        <ZoneTemplate>
                        <asp:Panel ID="PNL2" runat="server" title="Diary Summary">
                       <asp:UpdatePanel ID="udp_TopRight" runat="server" ChildrenAsTriggers="False" UpdateMode="Conditional">
                        <ContentTemplate>
                            <uc4:ucl_Diary_Summary ID="Ucl_Diary_Summary1" runat="server" Title="Diary Summary" />
                        </ContentTemplate>
                        </asp:UpdatePanel>
                        </asp:Panel>
                        </ZoneTemplate>
</asp:WebPartZone>

I can only assume its because I have my webparts - usercontrol wrapped in a panel (used for scrolling) and also an updatepanel which I use to refresh, so how do I get it to see the usercontrol?

Thanks in advance.

James.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

御弟哥哥 2024-07-20 18:01:54

我没有机会详细查看您的消息,但问题似乎出在您的提供商身上。 它应该返回一个对象,该对象实现用于与消费者通信的接口(通常是对其自身的引用)。

查看以下资源以获取详细信息:

ASP.NET Web 部件连接简介

I didn't have a chance to look at your message in detail but the issue appears to be with your provider. It should be returning an object that implements the interface used for communication to the consumer (usually a reference to itself).

Check out the following resource for more info:

Introducing ASP.NET Web Part Connections

你与清晨阳光 2024-07-20 18:01:54

我最终找到了我的问题/解决方案。

罗布,你是对的,我需要传回实现接口的对象的实例,但同时,你也不能引用静态连接的用户控件,它是其他两个控件(即面板和更新面板)的子控件。 我做的这一切都是错的。 我对其进行了更改,以便更新面板位于用户控件内部而不是默认页面上。 这样,所有特定(Web 部件)组件都是独立的。

另外,参考返回实例的原始项目,我将以下内容替换

Public Function Test() As String Implements IDiaryPartsProvider.Test
    Return "this is a test"
End Function

   <ConnectionProvider("myID")> _
Public Function Test() As IDiaryPartsProvider
    Return me
End Function


Public ReadOnly Property Test() As String Implements IDiaryPartsProvider.Test
    Get
        Return "This is a test"
    End Get
End Property

:希望这可以帮助别人!

詹姆士。

I found out my problem/solution in the end.

Rob you are correct I needed to pass back an instance of the object implementing the interface but also, you cant reference a User Control for a static connection which is a child of two other controls, namely the panel and update panel. I was doing this all wrong. I changed it so that the update panel is inside the user control rather than on the default page. That way all the specific (web part) components are self contained.

Also, referring back to the original item of returning the instance, I replaced the following:

Public Function Test() As String Implements IDiaryPartsProvider.Test
    Return "this is a test"
End Function

with:

   <ConnectionProvider("myID")> _
Public Function Test() As IDiaryPartsProvider
    Return me
End Function


Public ReadOnly Property Test() As String Implements IDiaryPartsProvider.Test
    Get
        Return "This is a test"
    End Get
End Property

Hope this can help someone!

James.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文