I would like to call a c# Method everytime a jquery UI slider event is happening.
This is pretty much the basic code of the jquery ui slider:
$("#slider").slider({
value: <%= getDayOfWeek() %>,
min: 0,
max: 6,
step: 1,
slidecreate: function (event, ui) {
$("#amount").val(day[ui.value]);
$("#MainContent_tagAuswahl").val(ui.value);
},
slide: function (event, ui) {
$("#amount").val(day[ui.valu开发者_运维百科e]);
$("#MainContent_tagAuswahl").val(ui.value);
}
});
$( "#amount" ).val( day[$( "#slider" ).slider( "value" )] );
});
I would love to fire a method call in the 'slide' event. How could I accomplish that. I know I could to it with PageMethods - but the method which I would like to call is not static.
Any help would be appreciated
If your using MVC its very easy to use $.get
to call a controller action.
If you're using web forms, I've posted a solution in the past that you can read here:
calling a public function of an asp.net ajax server control from client side
精彩评论