Update panel with a .net Calendar control having issues with asynctriggers & VisibleMonthChanged event

StackOverflow https://stackoverflow.com/questions/22162092

  •  19-10-2022
  •  | 
  •  

Question

I've got the following update panel wrapping around a Calendar control in .net

<asp:UpdatePanel runat="server" ID="CalendarPanel" UpdateMode="conditional">
    <ContentTemplate>
        <asp:Calendar ID="ClubCalendar" runat="server" Width="800" height="500"  DayHeaderStyle-CssClass="dateDayItem"/>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="ClubCalendar" EventName="SelectionChanged" />
        <asp:AsyncPostBackTrigger ControlID="ClubCalendar" EventName="VisibleMonthChanged" />
    </Triggers>
</asp:UpdatePanel>

My issue is with the VisibleMonthChanged event

I get the following error when loading the page

 The 'VisibleMonthChanged' event on associated control 'ClubCalendar' for the trigger in UpdatePanel 'CalendarPanel' does not match the standard event handler signature.

Any help with this would be greatly appreciated

Pas de solution correcte

Autres conseils

While I still don't know if its possible to setup the trigger for the VisibleMonthChanged event I was able to work around this by setting up the event in the code behind

 ClubCalendar.VisibleMonthChanged +=new MonthChangedEventHandler(ClubCalendar_VisibleMonthChanged);

and then calling the Panel update method manually.

void ClubCalendar_VisibleMonthChanged(Object sender, MonthChangedEventArgs e)
    {
        StartDate = e.NewDate;
        CalendarPanel.Update();
    }
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top