简体   繁体   English

带有.net日历控件的更新面板出现异步触发器和VisibleMonthChanged事件问题

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

I've got the following update panel wrapping around a Calendar control in .net 我有以下更新面板,围绕.net中的Calendar控件进行了包装

<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 我的问题是VisibleMonthChanged事件

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 任何帮助,将不胜感激

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 虽然我仍然不知道是否可以为VisibleMonthChanged事件设置触发器,但我可以通过在后面的代码中设置事件来解决此问题

 ClubCalendar.VisibleMonthChanged +=new MonthChangedEventHandler(ClubCalendar_VisibleMonthChanged);

and then calling the Panel update method manually. 然后手动调用Panel更新方法。

void ClubCalendar_VisibleMonthChanged(Object sender, MonthChangedEventArgs e)
    {
        StartDate = e.NewDate;
        CalendarPanel.Update();
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM