【问题标题】:Not able to access Javascript from Ajax calendar control无法从 Ajax 日历控件访问 Javascript
【发布时间】:2013-03-20 11:33:34
【问题描述】:

我正在使用文本框并将 Ajax 日历控件绑定到它。 我需要在日历客户端点击控件上执行javascript功能,怎么可能?

<asp:TextBox ID="txtdate" runat="server"   Width="150px"></asp:TextBox>
<ajax:CalendarExtender ID="CalendarExtender1" TargetControlID="txtdate" runat="server" OnClientDateSelectionChanged=”function” />

我可以在不使用 OnClientDateSelectionChanged 的​​情况下查看日历,但如果放置 OnClientDateSelectionChanged 我无法在文本框上看到日历控件。

【问题讨论】:

  • 这是OnClientDateSelectionChanged=”function” 正是您在标记中的内容吗?
  • OnClientDateSelectionChanged="function" 对上面的内容很抱歉

标签: ajax asp.net-ajax ajaxcontroltoolkit


【解决方案1】:

function 是 JavaScript 中的保留关键字,不能用作函数名。使用这个:

function calendarExtender1_DateSelectionChanged(sender, args){
    //....
}

<ajax:CalendarExtender ID="CalendarExtender1" TargetControlID="txtdate" runat="server" OnClientDateSelectionChanged=”calendarExtender1_DateSelectionChanged” />

【讨论】:

    猜你喜欢
    • 2012-10-29
    • 2017-05-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多