I might be going about this in totally the wrong way but this is what I'm doing:

I have 2 custom web parts: a company calendar and an appointment list. Both are visual webparts and both contain an UpdatePanel control. The calendar provides a date and the appointment list consumes a date. When the selected date in the calendar part changes the appointment list is notified. The UpdatePanel is intended to prevent the whole page from being refreshed.

This works fine when the page is loaded. However, when the calendar date is changed, a postback is raised. The appointment part is refreshed but the provider link is null. (i.e. the connection is not explicitly reinitialised) Therefore it is not possible to fetch the date from the provider (Calendar).

I tried to save the provider in the ViewState but I get an error saying that the calendar part is not marked as serialisable. At this point I start to wonder if I'm doing this wrong :-/

How should this be done?


This is how I got it to work.

  • Create a small serializable class in my provider which implements the interface
  • the consumer saves its' reference to the class in its' ViewState on PageLoad
  • the consumer is able to communicate with the provider using the instance of the class staored in the ViewState
  • WARNING the consumer should first read the value from the provider after the value has been set! PreRender is probably the best time to do this but it will depend on the implementation

@Vivek - it does appear to work without full page postback. Either that or the refresh is extremely fast ;-)

| improve this answer | |
  • Oh, that's good to know. please share the code if you can! – Vivek Nov 24 '10 at 18:28
  • i'd second the request to see a sample code. – Roman Jun 4 '14 at 6:34
  • Sorry, but I've moved on and don't do SharePoint any more. I have no access to the code. – paul Jun 4 '14 at 7:45

His webparts need to be within a single updatepanel (With this properties). Consider the following code:

<asp:UpdatePanel ID="updData" runat="server" EnableViewState="true" ChildrenAsTriggers="true" UpdateMode="Always">
        <WebPartPages:SPProxyWebPartManager runat="server" id="spproxywebpartmanager">
        <WebPartPages:WebPartZone id="g_024D9466249F4885A5400ECE7C9A6076" runat="server" title="Default">
| improve this answer | |

I believe that the web part connetcion mechanism still requires a full page postback, so having an update panel wont work sucessfully.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.