AJAX 日历用户控制下一个和上一个按钮问题
我创建了 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您在 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
我刚刚遇到了同样的问题。这似乎是因为我应用了位置:相对于父元素而引起的。
添加这个 CSS 解决了我的问题:
希望有帮助!
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:
Hope that helps!