我有日历弹出页面,所以它是隐藏的,当我选择日期,问题是当我点击进入下个月或前一个月,弹出页面将关闭,所以我需要检查是否点击进入日或月任何帮助请。
<asp:TextBox ID="txtEndDate" runat="server" ReadOnly="true"></asp:TextBox>
<asp:ImageButton ID="imgEndDate" runat="server" ImageUrl="~/Images/Calendar.png"
OnClick="imgEndDate_Click" Width="28px" Height="28px" ImageAlign="AbsMiddle" />
<asp:Panel ID="pnlEndCalendar" runat="server" BorderColor="Black" BackColor="White"
Height="250px" Width="330px" HorizontalAlign="Center">
<asp:Calendar ID="calEndDate" runat="server" BackColor="White" BorderColor="Black"
BorderStyle="Solid" CellSpacing="1" Font-Names="Verdana" Font-Size="9pt" ForeColor="Black"
Height="250px" NextPrevFormat="ShortMonth" Width="330px" OnSelectionChanged="calEndDate_SelectionChanged">
<DayHeaderStyle Font-Bold="True" Font-Size="8pt" ForeColor="#333333" Height="8pt" />
<DayStyle BackColor="#CCCCCC" />
<NextPrevStyle Font-Bold="True" Font-Size="8pt" ForeColor="White" />
<OtherMonthDayStyle ForeColor="#999999" />
<SelectedDayStyle BackColor="#333399" ForeColor="White" />
<TitleStyle BackColor="#333399" BorderStyle="Solid" Font-Bold="True" Font-Size="12pt"
ForeColor="White" Height="12pt" />
<TodayDayStyle BackColor="#999999" ForeColor="White" />
</asp:Calendar>
</asp:Panel>
<ajax:ModalPopupExtender ID="ModalPopupExtenderEndDate" runat="server" TargetControlID="imgEndDate"
PopupControlID="pnlEndCalendar" BackgroundCssClass="modalBackground">
</ajax:ModalPopupExtender>
发布于 2014-08-05 08:04:03
asp:日历是实现IPostBackEventHandler
的服务器端控件,因此该控件中的事件发送回发。
当您更改月份-引发事件VisibleMonthChanged并发送回发。
当发送回发父UpdatePanel
更新它的内容时,ModalPopupExtender
隐藏弹出。
为了解决问题,您需要在UpdatePanel
中包装日历,并在UpdatePanel
处理程序中手动为主UpdatePanel
设置触发器或更新主UpdatePanel
。
所以你需要这样修改你的标记
....
<UpdatePanel ID="main" UpdateMode="Conditional">
<ContentTemplate>
....
<asp:TextBox ID="txtEndDate" runat="server" ReadOnly="true"></asp:TextBox>
<asp:ImageButton ID="imgEndDate" ... />
<asp:Panel ID="pnlEndCalendar" runat="server" ...>
<UpdatePanel runat="server">
<ContentTemplate>
<asp:Calendar ID="calEndDate" runat="server"
OnSelectionChanged="calEndDate_SelectionChanged" ...>
....
</asp:Calendar>
</ContentTemplate>
</UpdatePanel>
</asp:Panel>
<ajax:ModalPopupExtender ID="ModalPopupExtenderEndDate" runat="server" TargetControlID="imgEndDate" PopupControlID="pnlEndCalendar" ...>
</ajax:ModalPopupExtender>
....
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="calEndDate" EventName="selectionchanged" />
</Triggers>
</UpdatePanel>
其中主UpdatePanel
是所有页面的UpdatePanel
https://stackoverflow.com/questions/25132622
复制相似问题