Let say I got the following button : <asp:Button ID="btnSearch" runat="server" /> and the following button event handler :
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSearch.Click
How, with JQuery, can I call the button event handler ?
What I mean is that I don’t want the page to refresh, so it’s kind of Ajax call. I don’t want to simulate the click but that on click the button event handler is call.
UPDATE
There are many ways of doing this asynchronously. You could have your button be set up as a trigger for an UpdatePanel, and then my original answer would still work. I wouldn’t do that, but that’s because I hate UpdatePanels.
You could create a page method in your code behind class, like this:
and in your ScriptManager (you’ll have to add one if you don’t have it), enable page methods.
Then, you don’t even need a server control for your button. Just use a plain old button.
Or you could call your page method directly from jquery, as shown by this Encosia article.
Or, you could have a completely separate service, not part of your code behind, that encapsulates your search logic, and you could call it any number of ways.
Since you’ve updated your question, you’re question isn’t really about how to execute your button’s click handler, it’s about how to do an async operation. And it’s a little vague. There are a million ways to do that.