Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers

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">
    <ContentTemplate>
        <WebPartPages:SPProxyWebPartManager runat="server" id="spproxywebpartmanager">
        </WebPartPages:SPProxyWebPartManager>
        <WebPartPages:WebPartZone id="g_024D9466249F4885A5400ECE7C9A6076" runat="server" title="Default">
            <ZoneTemplate>
            </ZoneTemplate>
        </WebPartPages:WebPartZone>
    </ContentTemplate>
</asp:UpdatePanel>
share|improve this answer
add comment
up vote 1 down vote accepted

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 ;-)

share|improve this answer
    
Oh, that's good to know. please share the code if you can! –  Vivek Nov 24 '10 at 18:28
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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