Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 带日历的弹出页面_C#_Asp.net - Fatal编程技术网

C# 带日历的弹出页面

C# 带日历的弹出页面,c#,asp.net,C#,Asp.net,我有日历在弹出页面,所以它是隐藏当我选择日期的问题是当我点击进入下个月或上个月的弹出页面将关闭,所以我需要检查,如果点击进入日期或月份任何帮助请 <asp:TextBox ID="txtEndDate" runat="server" ReadOnly="true"></asp:TextBox> <asp:ImageButton ID="imgEndDate" runat="server" ImageU

我有日历在弹出页面,所以它是隐藏当我选择日期的问题是当我点击进入下个月或上个月的弹出页面将关闭,所以我需要检查,如果点击进入日期或月份任何帮助请

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

是服务器端控件,它实现了
IPostBackEventHandler
,因此来自此控件的事件将发送回发

当您更改月-提高事件并发送回发时

发送回发时-父级
UpdatePanel
更新it内容,因此
ModalPopupXtender
隐藏弹出窗口

要解决此问题,您需要在
UpdatePanel
中包装日历,并在
calendar.OnSelectionChanged
处理程序中手动为main
UpdatePanel
或update main
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>
。。。。
....
....
....

其中Main
UpdatePanel
是所有页面的UpdatePanel

请发布一些示例代码。我发布了源代码。如果知道我检查按下的是月还是日期?@user3544536当您更改月日历控件时,请执行回发和ModalPopupXtender关闭弹出窗口,因此,如果您在更新面板中包装日历,则问题可能会在更新面板中解决。@user3544536在单独的更新面板中包装日历谢谢您,您很好:)