updatepanel回发上的JQuery timepicker选项

时间:2013-10-17 02:10:44

标签: jquery asp.net updatepanel timepicker

我使用了这个jquery插件:

http://fgelinas.com/code/timepicker/

动态地我正在尝试获取与onHourShow事件调用的OnHourShowCallback函数对应的一行代码。目标是根据DropDownList中选择的选项和用户选择的特定日期动态更改此代码行。根据所选办公室(DropDownList),所有这些都可用。

最初这行代码是空的,直到用户选择办公室并指示日期,时间表显示在时间戳中,但是在回发之后代码行继续为空。我尝试了返回此行的ASP.NET函数,手动发送参数并返回正确的数据。

这是我在头部的Js代码:

function prepareScripts() {
    $('#<%=Me.txtHrSalX.ClientID%>').timepicker({
        onHourShow: OnHourShowCallback
    });

    function OnHourShowCallback(hour) { <%= getHoursByOffice(Me.DropDownOffice.SelectedValue, Me.txtDate.Text) %>
        //if ((hour == 14 || hour == 15) || (hour > 20) || (hour < 6)) { return false; } // This is the dynamic line that I am trying to get
        return true; // valid
    }
}

$(document).ready(function () {
    prepareScripts()
});

这是ASP.Net代码:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

ScriptManager.RegisterStartupScript(Me, Me.GetType, "JQuery", "prepareScripts();", True)

End Sub

Public Function getHoursByOffice(ByVal strOffice As String, ByVal strDate As Date) As String

...

End Function

我想提一下我在同一页面上的datepicker JQuery,即使使用updatepanel回发也能完美运行。问题不在于更新面板内部的JQuery功能,问题是我无法更改此设置(OnHourShowCallback中的动态行)timepicker addon在更新面板中进行回发。

感谢您在这方面的任何帮助。

0 个答案:

没有答案