473,395 Members | 1,931 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

The ConnectWebParts method cannot be called after connections have already been activated (in WebPartManager.PreRender).

Hi all, I am dynamically making the connection between two webparts
when the consumer is added like so:

Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.PreRender
Dim wpGif, wpGroupSelector As WebParts.WebPart

Dim objWpManager As WebParts.WebPartManager =
CType(Page.Master.FindControl("wpmMain"), WebParts.WebPartManager)

Dim objPartCollection As WebParts.WebPartCollection =
objWpManager.WebParts
Dim objPart As WebParts.WebPart

Dim cpGroupSelector As WebParts.ProviderConnectionPoint
Dim cpGif As WebParts.ConsumerConnectionPoint

If ((Page.IsPostBack _
AndAlso (Request.Form("__EVENTARGUMENT") = "add" _
And Request.Form("__EVENTTARGET").IndexOf("czMain")
-1) _

Or Not Page.IsPostBack) _
) Then

For Each objPart In objPartCollection
If (objPart.AllowConnect) Then
If (objPart.Title = "Group Selector") Then
wpGroupSelector = objPart
ElseIf (objPart.Title = "GIFs") Then
wpGif = objPart
End If
End If
Next

If (Not IsNothing(wpGroupSelector)) Then
cpGroupSelector =
objWpManager.GetProviderConnectionPoints(wpGroupSe lector)(0)
End If

If (Not IsNothing(wpGif)) Then
cpGif =
objWpManager.GetConsumerConnectionPoints(wpGif)(0)
End If

If (Not IsNothing(cpGroupSelector) And Not IsNothing(wpGif)
_
AndAlso
objWpManager.CanConnectWebParts(wpGroupSelector, cpGroupSelector,
wpGif, cpGif)) Then
objWpManager.ConnectWebParts(wpGroupSelector,
cpGroupSelector, wpGif, cpGif)
End If

End If
End Sub

I know I am not showing all the code, but from what I have listed, can
anyone help me out. What is the deal? In the page_init the controls
don't exist, and in the page_prerender it's too late to connect them. I
am so close

Thank you for any help you can offer,
Ryan

May 1 '06 #1
0 1117

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: magne | last post by:
I have an http module (not made by me): To connect to a server and send a request, there is a method like this: public void sendRequest(String query){ .... } When the server responds, it...
3
by: Richard Urwin | last post by:
I'm using C# and having problems getting the 'Parse' EventHandler of my binding object to be called. Interestingly, the 'Format' method is always called however. A code snippet: (rdDocument is a...
1
by: John A Grandy | last post by:
somewhere in the .net framework libs , is the following intrinsically supplied 1. class-name & method that called the currently executing code 2. for overriden methods within a...
4
by: Jason P | last post by:
Basically we have a web method with a dynamic URL. The client is developed in C++ and I've been using the webReference.SetUrl( "http://test.example.com..." ) method successfully with various web...
0
by: Ivana | last post by:
Hi. I'm having trouble with my PocketPC program. I'm getting an InvalidProgramException when the SqlCeDataAdapter.Fill() method is called, and I have no clue why! Is there anybody who can tell me...
4
by: lakepeir | last post by:
Hello, I have combobox with a selectedindexchanged method that seems to be called when starting the application, launching the form with the combobox and making a change in the drop down box of...
3
by: emadattalla1983 | last post by:
Hi I've strange thing... I am developing web application using JSP in NetBeans5.5 and for the child pages, I find the init() method is called twice ?!! any idea about the reason behind this ?...
2
by: lukasz | last post by:
Hey is there a way to make certain method be called whenever any other method in my program is called (such global method hook), usable e.g. for logging or debugging?
2
by: Anil Gupte/iCinema.com | last post by:
I am getting the following message and no, it is not even going to that statement twice. Why is this happening? System.NotSupportedException was caught Message="FlushFinalBlock() method was...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.