Connecting Web Part Controls...

S

Steven

Hello All,

I have a program that implements two custom web parts, one as a
provider webpart and another as a consumer webpart.

The provider webpart contains a gridview control. When a row is
selected it then populates the consumer webparts textbox with
description data. The consumer webpart contains a text box for editing
the data (DescriptionContentText) and a button to update the
description received from the provider web part
(UpdateDescriptionContent). The event handle for the button click event
is connected in the consumer webparts CreateChildControl() method.

The problem is that this event is firing before the connection between
the two webparts has been created. Therefore when the event handler is
called, it checks if the provider (descriptionProvider) has been
created, always finds it set to null, and therefore never updates the
description field in the gridView (in the Web Part Provider)

Event Handler:
void UpdateDescriptionContent_Click(object sender, EventArgs e)
{
if (descriptionProvider != null)
{
descriptionProvider.Description =
DescriptionContentText.Text;
}
}

When I debug the program the methods to connect the web parts is always
called right after the button click event fires and before the
PreRender event is called. How then is it possible to cause the button
click to update the providers data?

Cheers for any help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top