【发布时间】:2020-01-19 13:25:46
【问题描述】:
这是我的代码:
function display() {
$(document).ready(function () {
var txtStart = $("#TextBox1");
var txtStartDate = $(txtStart).val(); //Value from arrival
var txtEnd = $("#TextBox2");
var txtEndDate = $(txtEnd).val();
var minDate = new Date(txtStartDate);
var maxDate = new Date(txtEndDate);
$("#slider").slider({
min: minDate.getTime(),
max: maxDate.getTime(),
step: 60 * 60 * 24 * 1000, // 1 day
slide: function (e, ui) {
var currentDate = new Date(ui.value);
$('#now').text(currentDate.toDateString());
},
change: function (e, ui) {
/*I want to run the code behind function here*/
}
});
});
}
【问题讨论】:
-
欢迎来到 SO。目前尚不清楚“功能背后”是什么意思?您想在更改之前运行 smth?
-
code behind 表示asp.net中aspx.cs中的一个函数
-
不,我不想改变之前的东西。我想在滑块的当前值更改时运行 aspx.cs 函数
-
如果我正在阅读正确的 aspx.cs,它是服务器端代码。因此,您将无法直接从客户端调用方法。您必须执行 ajax 调用。