AJAX 日历用户控制下一个和上一个按钮问题

发布于 2024-10-21 13:48:11 字数 2687 浏览 8 评论 0原文

我创建了 Ajax Calender Extender 作为用户控件,并在各个页面中使用相同的控件。我的日历用户控件问题是,当我单击日历中的“下一个”和“上一个”按钮时,它不会导航上个月或下个月。

AJAX 版本是:4.1.40412.2

AJAX 日历 CSS:

.ajax_calendar { 位置:相对; 左:0px!重要; 顶部:0px!重要; 可见性:可见; 显示:块; 背景颜色:红色; } .ajax_日历 iframe { 左:0px!重要; 顶部:0px!重要; 这

是我的用户控件:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UCCalender.ascx.cs"
Inherits="test.Web.Pages.UserControls.UCCalender" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxControl" %>

<div style="position:relative;border:solid 1px red;">
<asp:TextBox ID="txtDate" MaxLength="10" CssClass="txtBox medium" ToolTip="DD/MM/YYYY"
    Style="width: 85px;" Font-Size="11px" runat="server"></asp:TextBox>
<asp:ImageButton ImageUrl="~/Resources/Images/calendar.gif" ID="imgCalender" runat="Server"
    BorderWidth="0" ImageAlign="absmiddle" />
<ajaxControl:CalendarExtender ID="AjaxCalenderCtrl" runat="server" Format="dd/MM/yyyy" PopupPosition ="TopLeft" 
    TargetControlID="txtDate" FirstDayOfWeek="Sunday" PopupButtonID="imgCalender">
</ajaxControl:CalendarExtender>
<ajaxControl:TextBoxWatermarkExtender WatermarkCssClass="watermark" ID="txtWaterMarkDate"
    runat="server" WatermarkText="DD/MM/YYYY" TargetControlID="txtDate">
</ajaxControl:TextBoxWatermarkExtender>
<asp:RegularExpressionValidator ID="regexpvalEndDateEdit" ErrorMessage="!" ValidationExpression="(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d"
    ControlToValidate="txtDate" runat="server"></asp:RegularExpressionValidator>
    </div>

我以这种方式在页面中使用相同的 UserControl:

 <table id="inputDetails" style="padding: 0px; width: 700px;" cellpadding="0" cellspacing="0">

                            <tr>
                                <td style="width: 198px; position: relative" align="left">
                                    <asp:Label ID="lblBeginning" runat="server" Text="Beginning :" Style="margin-left: 10px;"></asp:Label>
                                    <asp:TextBox ID="tbxBeginCalendar" TabIndex="3" runat="server" Style="width: 85px;" Font-Size="11px"></asp:TextBox>


                            <asp:ImageButton ID="BeginCal" runat="server" ImageUrl= "~/Resources/Images/calendar.gif" />
                                  <uc1:UCCalender ID="UCCalStartDate" runat="server" />
                                </td>

                        </table>

请提供本文的解决方案。

I created Ajax Calender Extender as a user control and using the same in various pages. My problem with the calender user control is, When I click on the Next and Previous buttons in the calender It is not navigating previous month or next month.

AJAX version is : 4.1.40412.2

AJAX Calendar CSS :

.ajax_calendar
{
position: relative;
left: 0px !important;
top: 0px !important;
visibility: visible;
display: block;
background-color: Red;
}
.ajax
_calendar iframe
{
left: 0px !important;
top: 0px !important;
}

Here is my user Control is :

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UCCalender.ascx.cs"
Inherits="test.Web.Pages.UserControls.UCCalender" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxControl" %>

<div style="position:relative;border:solid 1px red;">
<asp:TextBox ID="txtDate" MaxLength="10" CssClass="txtBox medium" ToolTip="DD/MM/YYYY"
    Style="width: 85px;" Font-Size="11px" runat="server"></asp:TextBox>
<asp:ImageButton ImageUrl="~/Resources/Images/calendar.gif" ID="imgCalender" runat="Server"
    BorderWidth="0" ImageAlign="absmiddle" />
<ajaxControl:CalendarExtender ID="AjaxCalenderCtrl" runat="server" Format="dd/MM/yyyy" PopupPosition ="TopLeft" 
    TargetControlID="txtDate" FirstDayOfWeek="Sunday" PopupButtonID="imgCalender">
</ajaxControl:CalendarExtender>
<ajaxControl:TextBoxWatermarkExtender WatermarkCssClass="watermark" ID="txtWaterMarkDate"
    runat="server" WatermarkText="DD/MM/YYYY" TargetControlID="txtDate">
</ajaxControl:TextBoxWatermarkExtender>
<asp:RegularExpressionValidator ID="regexpvalEndDateEdit" ErrorMessage="!" ValidationExpression="(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d"
    ControlToValidate="txtDate" runat="server"></asp:RegularExpressionValidator>
    </div>

And I am using the same UserControl in the pages in this way:

 <table id="inputDetails" style="padding: 0px; width: 700px;" cellpadding="0" cellspacing="0">

                            <tr>
                                <td style="width: 198px; position: relative" align="left">
                                    <asp:Label ID="lblBeginning" runat="server" Text="Beginning :" Style="margin-left: 10px;"></asp:Label>
                                    <asp:TextBox ID="tbxBeginCalendar" TabIndex="3" runat="server" Style="width: 85px;" Font-Size="11px"></asp:TextBox>


                            <asp:ImageButton ID="BeginCal" runat="server" ImageUrl= "~/Resources/Images/calendar.gif" />
                                  <uc1:UCCalender ID="UCCalStartDate" runat="server" />
                                </td>

                        </table>

Please provide the solution for this post.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

面犯桃花 2024-10-28 13:48:11

当您在 IE8 中浏览 CalendarExtender 时,会出现此问题。您需要添加以下 CSS 类才能解决问题:
.MyCalendar .ajax__calendar_title
{
边框:无; /* 修复弹出标题中的“上一个”和“下一个”按钮 */
此处

对此进行了解释: http://ajaxcontroltoolkit.codeplex.com/workitem/22894

This problem happens when you browse the CalendarExtender in IE8. You need to add the following CSS class to have the problem solved:
.MyCalendar .ajax__calendar_title
{
border: none; /* Fixes the "previous" and "next" buttons in the popup title */
}

This is explained here: http://ajaxcontroltoolkit.codeplex.com/workitem/22894

独闯女儿国 2024-10-28 13:48:11

我刚刚遇到了同样的问题。这似乎是因为我应用了位置:相对于父元素而引起的。

添加这个 CSS 解决了我的问题:

.ajax__calendar_prev, .ajax__calendar_next{z-index:1;}

希望有帮助!

I have just come across this same issue. It was seemingly being caused because I had applied position:relative to the parent element.

Adding this this CSS fixed the issue for me:

.ajax__calendar_prev, .ajax__calendar_next{z-index:1;}

Hope that helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文