0

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.value]);
            $("#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

theXs
  • 437
  • 8
  • 25

1 Answers1

2

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

Community
  • 1
  • 1
asawyer
  • 17,642
  • 8
  • 59
  • 87
  • Thanks for the edit, I always think Mobile Construction Vehicle from Command & Conquer games and say MCV instead of MVC. Every. Single. Time. :) – asawyer Jul 22 '11 at 18:32