【问题标题】:Image Button causing postback instead of calender extender popup using AJAX使用 AJAX 导致回发而不是日历扩展器弹出的图像按钮
【发布时间】:2014-06-29 15:05:47
【问题描述】:

我正在使用 ajax 日历扩展器来获取日期,但是每当我单击图像按钮以弹出日历时,它都会导致回发。我这样做如下:

 <asp:TextBox ID="txtDate" runat="server" ToolTip="Last Date" CssClass="g2"</asp:TextBox> 
 <asp:ImageButton ID="ImageButton1" runat="server" Height="26px" width="30px" ImageUrl="~/images/cal.jpg"></asp:ImageButton>
<asp:CalendarExtender ID="txtDate_CalendarExtender" runat="server" 
 Enabled="True" TargetControlID="txtDate" PopupButtonID ="ImageButton1"></asp:CalendarExtender>

我很困惑,因为我以前从未遇到过这样的场景。

【问题讨论】:

    标签: asp.net ajax calendar asp.net-ajax


    【解决方案1】:

    你为什么不这样用,你为什么用日历延长器的按钮。

    <asp:TextBox ID="txtStartDate" runat="server"></asp:TextBox>  
    
    <asp:CalendarExtender ID="CalendarExtender1"  TargetControlID="txtStartDate"  runat="server"/>
    

    【讨论】:

    • 点击文本框时弹出日历我猜对用户不友好
    • 为什么? ,仅供参考,您可以使用 jquery 日历,这要好得多。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-04
    • 1970-01-01
    • 2013-06-25
    • 2019-01-20
    • 1970-01-01
    • 2015-12-23
    相关资源
    最近更新 更多