4

I need ASP.NET C# button click event to be done by the jQuery. The following sample code taken from my project in which instead of document.write('Passed') I need C# button click even to be done. How it can be done?

Sample code in which button click Button1_Click to be replaced instead of document.write

$("#slider").draggable({
        axis: 'x',
        containment: 'parent',
        drag: function(event, ui) {
            if (ui.position.left > 550) {
                document.write('Passed');
                $("#well").fadeOut();
            } else {
            }
        }

2 Answers 2

3

I'm not sure if this is what you want, but you could trigger the 'click' event for the button on the page using jQuery. This would cause your event to fire server side, as it would if the button had been manually clicked -

$('#yourbuttonid').trigger('click');
Sign up to request clarification or add additional context in comments.

Comments

1

I'm little confused here now. But This is what you want to be replace document.write

$("#Button1").click(function() {
                        alert("Hello world!");
                    });

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.