2014-02-11 88 views
0

我使用Ajax的日历日期选择器。当我点击日历图像时,页面将得到回传,但日历弹出窗口不会弹出。如何解决这个问题?阿贾克斯日历不工作

在此先感谢。

<asp:TextBox ID="txt_FromDate" runat="server" AutoPostBack="True" 
       ontextchanged="txt_FromDate_TextChanged> 
</asp:TextBox> 
<cc1:CalendarExtender ID="cal_FromDate" PopupButtonID="ibtnFromDate" 
         runat="server" TargetControlID="txt_FromDate" 
         Format="MM/dd/yyyy"> 
</cc1:CalendarExtender>  
<asp:ImageButton ID="ibtnFromDate" 
        ImageUrl="~/_layouts/images/PayrollImages/calendar.gif" 
        ImageAlign="Bottom" runat="server"/> 
+0

为什么您使用自动回? –

+0

@ user3295669张贴的代码工作对我很好..! – pravprab

+1

我想这个问题是不是与日历扩展,检查为什么回传出现的原因是什么?您在日历扩展程序代码中进行换行的位置?你能告诉我们的代码? –

回答

0

试试这个,

<asp:TextBox ID="txt_from" placeholder="MM/DD/YYYY" runat="server" 
      AutoPostBack="True" ontextchanged="txt_from_TextChanged"> 
</asp:TextBox> 
<cc1:CalendarExtender ID="txt_from_CalendarExtender" runat="server" 
         Format="MM/dd/yyyy" Enabled="True" 
         TargetControlID="txt_from"> 
</cc1:CalendarExtender> 

没有必要使用图像按钮日历。

-1

你只是缺少CalanderExtender PopupButtonID的属性。请尝试以下

<asp:TextBox ID="txt_FromDate" runat="server" AutoPostBack="True" 
      ontextchanged="txt_FromDate_TextChanged"> 
</asp:TextBox> 

<asp:ImageButton ID="ibtnFromDate" 
       ImageUrl="~/_layouts/images/PayrollImages/calendar.gif" 
       ImageAlign="Bottom" runat="server"/> 

<cc1:CalendarExtender ID="cal_FromDate" PopupButtonID="ibtnFromDate" 
         runat="server" PopupButtonID="ibtnFromDate" 
         TargetControlID="txt_FromDate" Format="MM/dd/yyyy"> 
</cc1:CalendarExtender>  
+0

-1他不是misiing“PopupButtonID”,你错了 – pravprab

1

试试这个:

<asp:TextBox ID="btn1" runat="server"> 
</asp:TextBox> 

<asp:ImageButton ID="img1" runat="server" 
       ImageUrl="~/_layouts/images/PayrollImages/calendar.gif"/> 

<cc1:CalendarExtender ID="calendar1" runat="server" PopupButtonID="img1" 
         TargetControlID="btn1" Enabled="True"> 
</cc1:CalendarExtender> 
0
<asp:TextBox ID="txtDOB" runat="server" Width="50%"></asp:TextBox> 

<cc1:CalendarExtender ID="txtDOB_CalendarExtender" runat="server" 
         TargetControlID="txtDOB" 
         Format="MM/dd/yyyy" PopupButtonID="imgDate" 
         PopupPosition="BottomLeft"> 
</cc1:CalendarExtender> 

<asp:Image ID="imgDate" AlternateText="Image Date" 
      ImageUrl="~/Images/Calendar.png" runat="server" />